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!

X-FeedAbuse http://nntpfeed.proxad.net/abuse.pl feeded by 195.154.70.45
Path csiph.com!usenet.pasdenom.info!nntpfeed.proxad.net!news.redatomik.org!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <itamar@itamarst.org>
X-Original-To python-announce-list@python.org
Delivered-To python-announce-list@mail.python.org
X-Spam-Status OK 0.004
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'url:pypi': 0.03; 'sys': 0.07; '__name__': 0.09; 'api': 0.11; 'python': 0.11; 'def': 0.12; '"""use': 0.16; "'__main__':": 0.16; '__future__': 0.16; 'blocking': 0.16; 'manner,': 0.16; 'to:addr:python-announce-list': 0.16; 'twisted': 0.16; 'library': 0.18; 'import': 0.22; 'setup,': 0.24; 'code:': 0.26; 'to:2**1': 0.27; 'code': 0.31; 'easier': 0.31; 'regular': 0.32; 'url:python': 0.33; 'received:10.20': 0.33; 'skip:d 20': 0.34; 'limitations': 0.36; 'url:org': 0.36; 'application': 0.37; 'received:10': 0.37; 'to:addr:python.org': 0.39; 'new': 0.61; 'name': 0.63; 'skip:r 30': 0.69; '3.4': 0.84
X-Virus-Scanned amavisd-new at kolabsys.net
X-Spam-Flag NO
X-Spam-Score -1.001
X-Spam-Level
X-Spam-Status No, score=-1.001 tagged_above=-10 required=6.31 tests=[ALL_TRUSTED=-1, BAYES_40=-0.001] autolearn=ham
Date Wed, 06 May 2015 21:03:11 -0400
From Itamar Turner-Trauring <itamar@itamarst.org>
To Twisted general discussion <twisted-python@twistedmatrix.com>, python-announce-list@python.org
Subject Crochet 1.4.0: use Twisted anywhere!
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
X-Mailman-Approved-At Fri, 08 May 2015 09:59:28 +0200
X-BeenThere python-announce-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id Announcement-only list for the Python programming language <python-announce-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-announce-list>, <mailto:python-announce-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-announce-list/>
List-Post <mailto:python-announce-list@python.org>
List-Help <mailto:python-announce-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-announce-list>, <mailto:python-announce-list-request@python.org?subject=subscribe>
Approved python-announce-list@python.org
Newsgroups comp.lang.python.announce
Message-ID <mailman.220.1431071969.12865.python-announce-list@python.org> (permalink)
Lines 34
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1431071969 news.xs4all.nl 2844 [2001:888:2000:d::a6]:36387
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python.announce:1693

Show key headers only | 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