Last active
August 7, 2016 08:18
-
-
Save dhcmrlchtdj/00a80d33bffbfbf230fe6836923f363b to your computer and use it in GitHub Desktop.
tornado.httpclient.AsyncHTTPClient + asyncio
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
#!/usr/bin/env python3 | |
from tornado.ioloop import IOLoop | |
from tornado.httpclient import AsyncHTTPClient | |
IOLoop.configure('tornado.platform.asyncio.AsyncIOLoop') | |
AsyncHTTPClient.configure('tornado.curl_httpclient.CurlAsyncHTTPClient') | |
async def example(): | |
resp = await AsyncHTTPClient().fetch('https://google.com/') | |
print(resp.body) | |
IOLoop.instance().run_sync(example) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment