0
我使用tornado异常地使用HTTP代理来获取许多网页。所以,我的许多feth'es完成与错误(我的代理是不可靠的)。我想用另一个代理立即重试它们。下面是例子:Python龙卷风httplib重试
from tornado import ioloop
from tornado import httpclient
def handle_request(response):
if response.error:
print "Error:", response.error
// HERE i want to put my retry with another proxy
else:
print response.body
ioloop.IOLoop.instance().stop()
http_client = httpclient.AsyncHTTPClient()
http_client.fetch("http://www.google.com/", handle_request)
ioloop.IOLoop.instance().start()
但如何我可以我添加新的handle_request电流环取事件?另外,我如何将变量传递到handle_request(列出所有我的代理)。