Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using tornado.httpclient.AsyncHTTPClient.fetch() to make a GET request along with parameters

As mentioned in the title, i want to make a asynchronous GET request using the fetch() method of AsyncHTTPclient.

But, I can't figure out where to give the query parameters.

So, say I want to make the request

http://xyz.com?a=1&b=2

where do I give the a and b? Is the only way to do this is by appending the parameters to the URL. Specifically, is there a way to pass a Dict which then gets appended to the URL by the Tornado framework.

like image 811
Hashken Avatar asked Jun 25 '13 08:06

Hashken


1 Answers

from tornado.httputil import url_concat
params = {"a": 1, "b": 2}
url = url_concat("http://example.com/", params)

http_client = AsyncHTTPClient()
http_client.fetch(url, request_callback_handler)
like image 52
vartec Avatar answered Sep 27 '22 21:09

vartec