Tornado 6.5 Documentation
RequestHandler which is subclassed to create web applications, and various supporting classes). • Client- and server-side implementions of HTTP (HTTPServer and AsyncHTTPClient). • An asynchronous networking function: from tornado.httpclient import HTTPClient def synchronous_fetch(url): http_client = HTTPClient() response = http_client.fetch(url) return response.body And here is the same function rewritten asynchronously httpclient import AsyncHTTPClient async def asynchronous_fetch(url): http_client = AsyncHTTPClient() response = await http_client.fetch(url) return response.body Or for compatibility with older versions0 码力 | 272 页 | 1.12 MB | 2 月前3Tornado 6.5 Documentation
HTTP server tornado.httpclient — Asynchronous HTTP client tornado.httputil — Manipulate HTTP headers and URLs tornado.http1connection – HTTP/1.x client/server implementation Asynchronous networking tornado (including RequestHandler which is subclassed to create web applications, and various supporting classes). Client- and server-side implementions of HTTP (HTTPServer and AsyncHTTPClient). An asynchronous networking tornado.httpclient import HTTPClient def synchronous_fetch(url): http_client = HTTPClient() response = http_client.fetch(url) return response.body And here is the same function rewritten0 码力 | 437 页 | 405.14 KB | 2 月前3Rust 程序设计语言 简体中文版 1.85.0
Protocol, HTTP)和 传输控制协议(Transmission Control Protocol,TCP)。这两者都是 请求 - 响应 (request-response)协议,也就是说,有 客户端(client)来初始化请求,并有 服务端 (server)监听请求并向客户端提供响应。请求与响应的内容由协议本身定义。 TCP 是一个底层协议,它描述了信息如何从一个 server 到另一个的细节,不过其并不指定信 读更多关于其他解决方案的内容并尝试实现它们;对于一个像 Rust 这样的底层语言,所有这 些方法都是可行的。 在开始之前,让我们讨论一下线程池应用看起来如何。当尝试设计代码时,首先编写客户端接 口(client interface)有助于指导代码设计。以期望的调用方式来构建 API 代码的结构,接着 在这个结构之内实现功能,而不是先实现功能再设计公有 API。 类似于第十二章项目中使用的测试驱动开发0 码力 | 562 页 | 3.23 MB | 10 天前3
共 3 条
- 1