I am now implementing the async query in tornado, and facing some problems. My code always returns DummyFuture does not support blocking for results. Googled some posts and it's seems I didn't add the return response into Future
. Try to modify my code but it still returns the same error. Please help to check my code.
from tornado import httpclient
query_url = 'https://some_url.com'
http_client = httpclient.AsyncHTTPClient()
def request(query_url):
resp = yield(http_client.fetch(query_url, method="GET"))
raise Return(resp.body)
response = request(query_url)
do_something_for_response(response)
My expected response
should be a json format and in the function do_something_for_response
, it handles the json and return to outside.
Thanks for your help.