Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python.announce > #1244
| Date | 2014-03-15 08:23 -0400 |
|---|---|
| From | Itamar Turner-Trauring <itamar@itamarst.org> |
| Subject | Crochet 1.1.0 - Use Twisted anywhere! |
| Newsgroups | comp.lang.python.announce |
| Message-ID | <mailman.8185.1395051600.18130.python-announce-list@python.org> (permalink) |
Crochet is an MIT-licensed library that makes it easier for blocking or
threaded applications like Flask or Django to use the Twisted networking
framework. Crochet provides the following features:
* Runs Twisted's reactor in a thread it manages.
* The reactor shuts down automatically when the process' main thread
finishes.
* Hooks up Twisted's log system to the Python standard library logging
framework. Unlike Twisted's built-in logging bridge, this includes
support for blocking Handler instances.
* A blocking API to eventual results (i.e. Deferred instances). This
last feature can be used separately, so Crochet is also useful for
normal Twisted applications that use threads.
Downloads: https://pypi.python.org/pypi/crochet
Documentation: https://crochet.readthedocs.org/en/latest/
*Trivial Example
*
"""
Download a web page in a blocking manner.
"""
from __future__ import print_function
import sys
from twisted.web.client import getPage
from crochet import setup, wait_for_reactor
setup()
@wait_for_reactor
def download_page(url):
return getPage(url)
# download_page() now behaves like a normal blocking function:
print(download_page(sys.argv[1]))
*What's New in 1.1.0*
Bug fixes:
* EventualResult.wait() can now be used safely from multiple threads,
thanks to Gavin Panella for reporting the bug.
* Fixed reentrancy deadlock in the logging code caused by
http://bugs.python.org/issue14976, thanks to Rod Morehead for
reporting the bug.
* Crochet now installs on Python 3.3 again, thanks to Ben Cordero.
* Crochet should now work on Windows, thanks to Konstantinos Koukopoulos.
* Crochet tests can now run without adding its absolute path to
PYTHONPATH or installing it first.
Documentation:
* EventualResult.original_failure is now documented.
**
Back to comp.lang.python.announce | Previous | Next | Find similar | Unroll thread
Crochet 1.1.0 - Use Twisted anywhere! Itamar Turner-Trauring <itamar@itamarst.org> - 2014-03-15 08:23 -0400
csiph-web