Search code examples
pythonasynchronoustornadohttp-error

tornado.httpclient.HTTPError: HTTP 599: Timeout during request


I'm trying to make a long async http request using Python Tornado AsyncHTTPClient:

url = 'http://do_something_for_more_than_20_seconds.com/
client = httpclient.AsyncHTTPClient()
response = await client.fetch(url, method='GET')

But, after 20 seconds, I get this error:

tornado.httpclient.HTTPError: HTTP 599: Timeout during request

How can I configure the client in order to allow long requests?

I have tried to add this configuration row after the initialization of the client, but still it doesn't work:

client.configure(None, defaults=dict(connect_timeout=60, request_timeout=120))

Solution

  • It should work if you move the configuration of timeouts in constructor of client

    client = httpclient.AsyncHTTPClient(defaults=dict(request_timeout=180))