Skip to content

Instantly share code, notes, and snippets.

@velotiotech
Created June 25, 2020 10:29
Show Gist options
  • Save velotiotech/5fe63eb5fd6cf3af9bf353c2fd3b4ca7 to your computer and use it in GitHub Desktop.
Save velotiotech/5fe63eb5fd6cf3af9bf353c2fd3b4ca7 to your computer and use it in GitHub Desktop.
Tornado async http client
from tornado.httpclient import AsyncHTTPClient
from tornado import gen
@gen.coroutine
def async_fetch_gen(url):
http_client = AsyncHTTPClient()
response = yield http_client.fetch(url)
raise gen.Return(response.body)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment