Tornado 6.4 Documentation
the browser • HTTP servers and clients ☐ tornado.httpserver — Non-blocking HTTP server • tornado.httpclient — Asynchronous HTTP client • tornado.httputil — Manipulate HTTP headers and URLs tornado with the await or yield keywords. ## Examples Here is a sample synchronous function: from tornado.httpclient import HTTPClient def synchronous_fetch(url): http_client = HTTPClient() response response.body And here is the same function rewritten asynchronously as a native coroutine: from tornado.httpclient importAsyncHTTPClient async def asynchronous_fetch(url): http_client =AsyncHTTPClient()0 码力 | 432 页 | 402.58 KB | 2 年前3
Tornado 6.2 Documentation
with the await or yield keywords. ## Examples Here is a sample synchronous function: from tornado.httpclient import HTTPClient def synchronous_fetch(url): http_client = HTTPClient() response = response.body And here is the same function rewritten asynchronously as a native coroutine: from tornado.httpclient importAsyncHTTPClient async def asynchronous_fetch(url): http_client =AsyncHTTPClient() body Or for compatibility with older versions of Python, using the tornado.gen module: from tornado.httpclient importAsyncHTTPClient from tornado import gen @gen.coroutine def async_fetch_gen(url):0 码力 | 260 页 | 1.06 MB | 2 年前3
Tornado 6.1 Documentation
with the await or yield keywords. ## Examples Here is a sample synchronous function: from tornado.httpclient import HTTPClient def synchronous_fetch(url): http_client = HTTPClient() response response.body And here is the same function rewritten asynchronously as a native coroutine: from tornado.httpclient importAsyncHTTPClient async def asynchronous_fetch(url): http_client =AsyncHTTPClient() body Or for compatibility with older versions of Python, using the tornado.gen module: from tornado.httpclient importAsyncHTTPClient from tornado import gen @gen.coroutine def async_fetch_gen(url):0 码力 | 245 页 | 904.24 KB | 2 年前3
Tornado 6.4 Documentation
with the await or yield keywords. ## Examples Here is a sample synchronous function: from tornado.httpclient import HTTPClient def synchronous_fetch(url): http_client = HTTPClient() response = response.body And here is the same function rewritten asynchronously as a native coroutine: from tornado.httpclient importAsyncHTTPClient async def asynchronous_fetch(url): http_client =AsyncHTTPClient() body Or for compatibility with older versions of Python, using the tornado.gen module: from tornado.httpclient importAsyncHTTPClient from tornado import gen @gen.coroutine def async_fetch_gen(url):0 码力 | 268 页 | 1.09 MB | 2 年前3
Tornado 6.4 Documentation
with the await or yield keywords. ## Examples Here is a sample synchronous function: from tornado.httpclient import HTTPClient def synchronous_fetch(url): http_client = HTTPClient() response = response.body And here is the same function rewritten asynchronously as a native coroutine: from tornado.httpclient importAsyncHTTPClient async def asynchronous_fetch(url): http_client =AsyncHTTPClient() body Or for compatibility with older versions of Python, using the tornado.gen module: from tornado.httpclient importAsyncHTTPClient from tornado import gen @gen.coroutine def async_fetch_gen(url):0 码力 | 268 页 | 1.09 MB | 2 年前3
Tornado 6.4 Documentation
with the await or yield keywords. ## Examples Here is a sample synchronous function: from tornado.httpclient import HTTPClient def synchronous_fetch(url): http_client = HTTPClient() response = response.body And here is the same function rewritten asynchronously as a native coroutine: from tornado.httpclient importAsyncHTTPClient async def asynchronous_fetch(url): http_client =AsyncHTTPClient() body Or for compatibility with older versions of Python, using the tornado.gen module: from tornado.httpclient importAsyncHTTPClient from tornado import gen @gen.coroutine def async_fetch_gen(url):0 码力 | 268 页 | 1.09 MB | 2 年前3
Tornado 6.3 Documentation
with the await or yield keywords. ## Examples Here is a sample synchronous function: from tornado.httpclient import HTTPClient def synchronous_fetch(url): http_client = HTTPClient() response = response.body And here is the same function rewritten asynchronously as a native coroutine: from tornado.httpclient importAsyncHTTPClient async def asynchronous_fetch(url): http_client =AsyncHTTPClient() body Or for compatibility with older versions of Python, using the tornado.gen module: from tornado.httpclient importAsyncHTTPClient from tornado import gen @gen.coroutine def async_fetch_gen(url):0 码力 | 264 页 | 1.06 MB | 2 年前3
Tornado 6.5 Documentationresult with the await or yield keywords. Examples Here is a sample synchronous function: from tornado.httpclient import HTTPClient def synchronous_fetch(url): http_client = HTTPClient() response = http_client 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 = AsyncHTTPClient() response tornado.gen module: 14 Chapter 6. Documentation Tornado Documentation, Release 6.5.1 from tornado.httpclient import AsyncHTTPClient from tornado import gen @gen.coroutine def async_fetch_gen(url): http_client0 码力 | 272 页 | 1.12 MB | 10 月前3
Tornado 6.0 Documentation
with the await or yield keywords. ## Examples Here is a sample synchronous function: from tornado.httpclient import HTTPClient def synchronous_fetch(url): http_client = HTTPClient() response response.body And here is the same function rewritten asynchronously as a native coroutine: from tornado.httpclient importAsyncHTTPClient async def asynchronous_fetch(url): http_client =AsyncHTTPClient() body Or for compatibility with older versions of Python, using the tornado.gen module: from tornado.httpclient importAsyncHTTPClient from tornado import gen @gen.coroutine def async_fetch_gen(url):0 码力 | 245 页 | 885.76 KB | 2 年前3
Tornado 5.1 Documentation
with the await or yield keywords. ## Examples Here is a sample synchronous function: from tornado.httpclient import HTTPClient def synchronous_fetch(url): http_client = HTTPClient() response response.body And here is the same function rewritten asynchronously as a native coroutine: from tornado.httpclient importAsyncHTTPClient async def asynchronous_fetch(url): http_client =AsyncHTTPClient() body Or for compatibility with older versions of Python, using the tornado.gen module: from tornado.httpclient importAsyncHTTPClient from tornado import gen @gen.coroutine def async_fetch_gen(url):0 码力 | 243 页 | 895.80 KB | 2 年前3
共 20 条
- 1
- 2













