The
concurrent.futures.ThreadPoolExecutor
class provides us:A high-level interface for synchronously executing callables.
A high-level interface for asynchronously executing callables.
A high-level interface for composing HTTP requests.
The
@tornado.concurrent.run_on_executor
decorator allows us to:Run an asynchronous method synchronously on an executor.
Run an asynchronous method on an executor without generating a Future.
Run a synchronous method asynchronously on an executor.
The recommended way to write asynchronous code in Tornado is to use:
Coroutines.
Chained callbacks.
Subroutines.
The
tornado.Testing.AsyncHTTPTestCase
class represents:A test case that starts up a Flask HTTP Server.
A test case that starts up a Tornado HTTP Server.
A test case that doesn't start up any HTTP Server.
If we want to convert the bytes in a JSON response body to a Python dictionary, we can use the following function:
tornado.escape.json_decode
tornado.escape.byte_decode
tornado.escape...
You're reading from Building RESTful Python Web Services
The rest of the page is locked
You have been reading a chapter from
Building RESTful Python Web ServicesPublished in: Oct 2016Publisher: PacktISBN-13: 9781786462251
© 2016 Packt Publishing Limited All Rights Reserved