Tornado 6.5 Documentation
http_client.fetch(url) return response.body And here is the same function rewritten asynchronously as a native coroutine: from tornado.httpclient import AsyncHTTPClient async def asynchronous_fetch(url): http_client 15Tornado Documentation, Release 6.5.1 Native vs decorated coroutines Python 3.5 introduced the async and await keywords (functions using these keywords are also called “native corou- tines”). For compatibility you can use “decorated” or “yield-based” coroutines using the tornado.gen.coroutine decorator. Native coroutines are the recommended form whenever possible. Only use decorated coroutines when compatibility0 码力 | 272 页 | 1.12 MB | 2 月前3Tornado 6.5 Documentation
guide Introduction Asynchronous and non-Blocking I/O Blocking Asynchronous Examples Coroutines Native vs decorated coroutines How it works How to call a coroutine Coroutine patterns Calling blocking fetch(url) return response.body And here is the same function rewritten asynchronously as a native coroutine: from tornado.httpclient import AsyncHTTPClient async def asynchronous_fetch(url): fetch(url) return response.body Native vs decorated coroutines Python 3.5 introduced the async and await keywords (functions using these keywords are also called “native coroutines”). For compatibility0 码力 | 437 页 | 405.14 KB | 2 月前3
共 2 条
- 1
相关搜索词