Skip to main content

An easy way to seamlessly use Greenlet with Tornado

Project description


An easy way to seamlessly use Greenlet with Tornado.

This allows you to write code as if it were synchronous, and not worry about callbacks at all.
You also don't have to use any special patterns, such as writing everything as a generator.

Overall this allows you to structure your program in a much more sensible, straightforward way.
It's also immensely helpful when porting synchronous code to Tornado.

Derived from this blog article:


pip install greenlet_tornado

Example Usage:

import tornado.web
from greenlet_tornado import greenlet_asynchronous, greenlet_fetch

class ExampleHandler(tornado.web.RequestHandler):
def get(self):
# ...
# ...
self.write("Hello World!")

def helper(self):
# Fetch something. greenlet_fetch() will block until the request is complete,
# but the tornado IOLoop can do other things in the meantime.
http_response = greenlet_fetch("")
# ... Do something with the response ...

Run tests

pip install -r requirements_tests.txt
nosetests -s --cover-branches --cover-erase --with-coverage --cover-inclusive --cover-package=greenlet_tornado --tests=tests

Project details

Release history Release notifications

This version
History Node


History Node


History Node


History Node


History Node


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
greenlet_tornado-1.1.3.tar.gz (5.1 kB) Copy SHA256 hash SHA256 Source None Feb 1, 2017

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page