I'm working with twisted. I'm a little bit confused about using deferred objects. I see me correct result in this deferred but I can't work with it.
For example
def hello(defer):
print(defer)
Just printest me
Deferred at 0x24dv5f5 current result: 44
How can I access this result?
Update
This is my code where I try to fire the deferred
def handleLoginFailed(self, sid, args):
d = defer.Deferred()
d.callback(sid)
def writeLoginFailed(sid, args):
print("sid:", sid)
self.simpleQuery(
"""
INSERT INTO auth
(session, success, username, password, timestamp)
VALUES (%s, %s, %s, %s, FROM_UNIXTIME(%s))
""",
(sid, 0, args['username'],
args['password'], self.nowUnix()))
d.addCallback(writeLoginFailed(sid, args))
d = Deferred()
d.callback("the result")
def handleTheResult(result):
print "The Deferred fired, its result is:", result
d.addCallback(handleTheResult)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With