Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python.announce > #1693

Crochet 1.4.0: use Twisted anywhere!

Date 2015-05-06 21:03 -0400
From Itamar Turner-Trauring <itamar@itamarst.org>
Subject Crochet 1.4.0: use Twisted anywhere!
Newsgroups comp.lang.python.announce
Message-ID <mailman.220.1431071969.12865.python-announce-list@python.org> (permalink)

Show all headers | View raw


Crochet is an MIT-licensed library that makes it easier to use Twisted 
from regular blocking code:

from __future__ import print_function
from twisted.names import client
from crochet import setup, wait_for
setup()

@wait_for(timeout=5.0)
def gethostbyname(name):
     """Use the Twisted DNS library."""
     d = client.lookupAddress(name)
     d.addCallback(lambda result: result[0][0].payload.dottedQuad())
     return d

if __name__ == '__main__':
     # Application code using the public API - notice it works in a normal
     # blocking manner, with no event loop visible:
     import sys
     name = sys.argv[1]
     ip = gethostbyname(name)
     print(name, "->", ip)


New in 1.4.0 is Python 3.4 support as well as support for using Crochet 
with uWSGI, and additional documentation on workarounds for various 
limitations of Crochet.

https://pypi.python.org/pypi/crochet for downloads.
https://crochet.readthedocs.org/ for documentation.


--Itamar Turner-Trauring

Back to comp.lang.python.announce | Previous | Next | Find similar | Unroll thread


Thread

Crochet 1.4.0: use Twisted anywhere! Itamar Turner-Trauring <itamar@itamarst.org> - 2015-05-06 21:03 -0400

csiph-web