I want to send it and forget it. The http rest service call I'm making takes a few seconds to respond. The goal is to avoid waiting those few seconds before more code can execute. I'd rather not use python threads I'll use twisted async calls if I must and ignore the response.
views:
68answers:
3
A:
HTTP implies a request and a reply for that request. Go with an async approach.
thelost
2010-08-15 05:52:17
+2
A:
You are going to have to implement that asynchronously as HTTP protocol states you have a request and a reply.
Another option would be to work directly with the socket, bypassing any pre-built module. This would allow you to violate protocol and write your own bit that ignores any responses, in essence dropping the connection after it has made the request.
Josh K
2010-08-15 05:54:24
A:
You do not need twisted for this, just urllib will do. See http://pythonquirks.blogspot.com/2009/12/asynchronous-http-request.html
I am copying the relevant code here but the credit goes to that link:
import urllib2 class MyHandler(urllib2.HTTPHandler): def http_response(self, req, response): return response o = urllib2.build_opener(MyHandler()) o.open('http://www.google.com/')
chx
2010-08-15 21:28:12