Re: [tornado] Set timeout to an http request in Tornado

137 views
Skip to first unread message

roy lieu

unread,
Mar 12, 2013, 11:59:26 AM3/12/13
to python-...@googlegroups.com
you must use ioloop.add_timeout.

Irene Bontà <irene...@gmail.com> wrote:

I have this part of code:

como_url = "".join(['http://', options.como_address, ':', options.como_port, 
                        '/ztc_config?netid=0&opcode_group=0&opcode=0&start=-20s&end=-1s'])
http_client = AsyncHTTPClient()
request = tornado.httpclient.HTTPRequest(url=como_url, connect_timeout=20.0, request_timeout=20.0)
response = yield tornado.gen.Task(http_client.fetch, request)

I don't know why seems the timeouts doesn't work!

Any idea? Thanks.

--
You received this message because you are subscribed to the Google Groups "Tornado Web Server" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-tornad...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ben Darnell

unread,
Mar 12, 2013, 9:49:57 PM3/12/13
to Tornado Mailing List
You don't need IOLoop.add_timeout here; AsyncHTTPClient should take care of that with the connect_timeout and request_timeout arguments.  What you've written here should work; I don't see anything wrong with it.  Is there anything interesting in the logs?  Is all of this appearing in a function with the @gen.engine decorator?

-Ben

Yuan Wang

unread,
Mar 12, 2013, 10:19:43 PM3/12/13
to python-...@googlegroups.com
Try to use tornado.simple_httpclient.SimpleAsyncHTTPClient.


2013/3/13 Ben Darnell <b...@bendarnell.com>



--
-----------------------------------------------------------------------------------------------------
王 远
MSN:yuanwa...@hotmail.com
QQ  :807228688
 

Aleksey Silk

unread,
Mar 13, 2013, 2:26:07 AM3/13/13
to python-...@googlegroups.com
So, how it must to be ... any code example?


С уважением, Алексей Силк
With best regards, Aleksey Silk
 
skype - rootiks
 


2013/3/13 Yuan Wang <yuanwa...@gmail.com>
Reply all
Reply to author
Forward
0 new messages