January 2019
Beginner to intermediate
776 pages
19h 58m
English
We will build a concurrent application to illustrate the functionality of Tornado. In this example, the tornado.concurrent module of Tornado has been used.
Listing 4.13 explains the code for a simple concurrent application using Tornado:
#!/usr/bin/env python # Python Network Programming Cookbook, Second Edition -- Chapter - 3 # This program is optimized for Python 3.5.2. # It may run on any other version with/without modifications. import argparse import time import datetime import tornado.httpserver import tornado.ioloop import tornado.options import tornado.web from tornado import gen from tornado.concurrent import return_future class AsyncUser(object): @return_future def req1(self, callback=None): time.sleep(0.1) result ...
Read now
Unlock full access