Tornado 6.5 Documentation
The following optional packages may be useful: • pycurl is used by the optional tornado.curl_httpclient. Libcurl version 7.22 or higher is required. • pycares is an alternative non-blocking DNS resolver Examples Here is a sample synchronous function: from tornado.httpclient import HTTPClient def synchronous_fetch(url): http_client = HTTPClient() response = http_client.fetch(url) return response.body And 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() response0 码力 | 272 页 | 1.12 MB | 2 月前3Tornado 6.5 Documentation
optional packages may be useful:pycurl [http://pycurl.io/] is used by the optional tornado.curl_httpclient. Libcurl version 7.22 or higher is required. pycares [https://pypi.org/project/pycares/] is an to 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.http1connection Examples Here is a sample synchronous function: from tornado.httpclient import HTTPClient def synchronous_fetch(url): http_client = HTTPClient() response = http_client.fetch(url) return response0 码力 | 437 页 | 405.14 KB | 2 月前3
共 2 条
- 1
相关搜索词