Created
June 25, 2020 10:29
-
-
Save velotiotech/5fe63eb5fd6cf3af9bf353c2fd3b4ca7 to your computer and use it in GitHub Desktop.
Tornado async http client
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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