使用tornado.httpclient下载—;非阻塞Python
我需要将param1和param2传递给handle_请求使用:使用tornado.httpclient下载—;非阻塞Python,python,callback,tornado,Python,Callback,Tornado,我需要将param1和param2传递给handle_请求使用: 谢谢@Ben Darnell你救了我一天:) def handle_request(param1,param2): if response.error: print "Error:", response.error else: print response.body print param1 print param2 param1 param2 h
谢谢@Ben Darnell你救了我一天:)
def handle_request(param1,param2):
if response.error:
print "Error:", response.error
else:
print response.body
print param1
print param2
param1
param2
http_client = AsyncHTTPClient()
http_client.fetch("http://www.google.com/", handle_request)
import functools
# handle_response will be called with three arguments:
# first the ones from the partial, and then the response
def handle_response(param1, param2, response): pass
http_client.fetch("http://www.google.com",
functools.partial(handle_request, param1, param2))