Crochet is an MIT-licensed library that makes it easier for threaded
applications like Flask or Django to use the Twisted networking framework.
Features include:
- Runs Twisted's reactor in a thread it manages.
- Hooks up Twisted's log system to the Python standard library
loggingframework. Unlike Twisted's built-in
logging bridge, this includes support for blocking Handler instances.
- Provides a blocking API to eventual results (i.e. Deferred instances).
This release includes better documentation and API improvements, as well as
better error reporting.
Here is a simple example of using Crochet:
import sys
from twisted.web.client import getPagefrom crochet import setup,
run_in_reactorcrochet.setup()
@run_in_reactordef download_page(url):
return getPage(url)
result = download_page(sys.argv[1])# wait() returns the result when it
becomes available:print result.wait()
You can see more examples, read the documentation, and download the package
at:
https://pypi.python.org/pypi/crochet
--
Itamar Turner-Trauring, Future Foundries LLC
http://futurefoundries.com/ — Twisted consulting, training and support.
_______________________________________________
Twisted-Python mailing list
[email protected]
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python