[Twisted-Python] using defferred?

Don Hiatt don at motorola.com
Wed Jul 9 16:17:53 EDT 2003


So I have a simple client that connects to "A" and sends
a requests and waits for a response. I'm using the clientfactory
and it works great. Now, I would like to integrate it with
a webserver, so when the user requests a certain url, I will
have my client connects to "A", send the request, wait for
the response, and then render the result in html and pass it
back to the user. The problem is, how do you do this in a 
event based system? I suspect Defferred might be my friend but 
I'm not sure.

My app looks like

class Simple(resource.Resource):
	isLeaf = True
	def render(self, request):
		... How do I wait for the client's datarecieved method
		.... to be called and then have access to the data??
		return result

m = Factory()

site = server.Site(Simple())
app.listenTCP(8888, site)

Thanks a lot for your time.



More information about the Twisted-Python mailing list