Tornado 5.1 Documentation
which serve as the building blocks for the HTTP components and can also be used to implement other protocols. • A coroutine library (tornado.gen) which allows asynchronous code to be written in a more straightforward low-level components like the IOLoop that use callbacks. Futures are usually transformed into their result with the await or yield keywords. Examples Here is a sample synchronous function: from tornado AsyncHTTPClient() my_future = Future() fetch_future = http_client.fetch(url) def on_fetch(f): my_future.set_result(f.result().body) fetch_future.add_done_callback(on_fetch) return my_future Notice that the coroutine0 码力 | 243 页 | 895.80 KB | 1 年前3
Tornado 4.5 Documentation
which serve as the building blocks for the HTTP components and can also be used to implement other protocols. A coroutine library (tornado.gen) which allows asynchronous code to be written in a more straightforward fetch_future = http_client.fetch(url) fetch_future.add_done_callback( lambda f: my_future.set_result(f.result())) return my_future The raw Future version is more complex, but Futures are nonetheless Tornado because they have two major advantages. Error handling is more consistent since the Future.result method can simply raise an exception (as opposed to the ad-hoc error handling common in callback-oriented0 码力 | 333 页 | 322.34 KB | 1 年前3
Tornado 5.1 Documentation
which serve as the building blocks for the HTTP components and can also be used to implement other protocols. A coroutine library (tornado.gen) which allows asynchronous code to be written in a more straightforward low-level components like the IOLoop that use callbacks. Futures are usually transformed into their result with the await or yield keywords. Examples Here is a sample synchronous function: from tornado my_future = Future() fetch_future = http_client.fetch(url) def on_fetch(f): my_future.set_result(f.result().body) fetch_future.add_done_callback(on_fetch) return my_future Notice that the coroutine0 码力 | 359 页 | 347.32 KB | 1 年前3
Tornado 6.0 Documentation
compatible with Tornado. Applications that use Tornado on Windows with Python 3.8 must call asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) at the beginning of their main file/function which serve as the building blocks for the HTTP components and can also be used to implement other protocols. A coroutine library (tornado.gen) which allows asynchronous code to be written in a more straightforward low-level components like the IOLoop that use callbacks. Futures are usually transformed into their result with the await or yield keywords. Examples Here is a sample synchronous function: from tornado0 码力 | 869 页 | 692.83 KB | 1 年前3
Tornado 4.5 Documentation
which serve as the building blocks for the HTTP components and can also be used to implement other protocols. • A coroutine library (tornado.gen) which allows asynchronous code to be written in a more straightforward fetch_future = http_client.fetch(url) fetch_future.add_done_callback( lambda f: my_future.set_result(f.result())) return my_future The raw Future version is more complex, but Futures are nonetheless Tornado because they have two major advantages. Error handling is more consistent since the Future.result method can simply raise an exception (as opposed to the ad-hoc error handling common in callback-oriented0 码力 | 222 页 | 833.04 KB | 1 年前3
Tornado 6.1 Documentation
which serve as the building blocks for the HTTP components and can also be used to implement other protocols. • A coroutine library (tornado.gen) which allows asynchronous code to be written in a more straightforward low-level components like the IOLoop that use callbacks. Futures are usually transformed into their result with the await or yield keywords. Examples Here is a sample synchronous function: from tornado AsyncHTTPClient() my_future = Future() fetch_future = http_client.fetch(url) def on_fetch(f): my_future.set_result(f.result().body) fetch_future.add_done_callback(on_fetch) return my_future Notice that the coroutine0 码力 | 245 页 | 904.24 KB | 1 年前3
Tornado 6.1 Documentation
which serve as the building blocks for the HTTP components and can also be used to implement other protocols. A coroutine library (tornado.gen) which allows asynchronous code to be written in a more straightforward low-level components like the IOLoop that use callbacks. Futures are usually transformed into their result with the await or yield keywords. Examples Here is a sample synchronous function: from tornado = Future() fetch_future = http_client.fetch(url) def on_fetch(f): my_future.set_result(f.result().body) fetch_future.add_done_callback(on_fetch) return my_future Notice that the coroutine0 码力 | 931 页 | 708.03 KB | 1 年前3
Tornado 6.5 Documentationwhich serve as the building blocks for the HTTP components and can also be used to implement other protocols. The Tornado web framework and HTTP server together offer a full-stack alternative to WSGI. While low- level components like the IOLoop that use callbacks. Futures are usually transformed into their result with the await or yield keywords. Examples Here is a sample synchronous function: from tornado AsyncHTTPClient() my_future = Future() fetch_future = http_client.fetch(url) def on_fetch(f): my_future.set_result(f.result().body) fetch_future.add_done_callback(on_fetch) return my_future Notice that the coroutine0 码力 | 272 页 | 1.12 MB | 3 月前3
Tornado 6.4 Documentation
which serve as the building blocks for the HTTP components and can also be used to implement other protocols. The Tornado web framework and HTTP server together offer a full-stack alternative to WSGI. While low- level components like the IOLoop that use callbacks. Futures are usually transformed into their result with the await or yield keywords. Examples Here is a sample synchronous function: from tornado AsyncHTTPClient() my_future = Future() fetch_future = http_client.fetch(url) def on_fetch(f): my_future.set_result(f.result().body) fetch_future.add_done_callback(on_fetch) return my_future Notice that the coroutine0 码力 | 268 页 | 1.09 MB | 1 年前3
Tornado 6.4 Documentation
which serve as the building blocks for the HTTP components and can also be used to implement other protocols. The Tornado web framework and HTTP server together offer a full-stack alternative to WSGI. While low- level components like the IOLoop that use callbacks. Futures are usually transformed into their result with the await or yield keywords. Examples Here is a sample synchronous function: from tornado AsyncHTTPClient() my_future = Future() fetch_future = http_client.fetch(url) def on_fetch(f): my_future.set_result(f.result().body) fetch_future.add_done_callback(on_fetch) return my_future Notice that the coroutine0 码力 | 268 页 | 1.09 MB | 1 年前3
共 20 条
- 1
- 2













