[Twisted-Python] asynchronous python generator
ltaylor.volks at gmail.com
Mon Jul 12 14:35:02 EDT 2010
On 7/12/10 11:43 AM, Jean Daniel wrote:
> I wrote a small client protocol which connects to a notification
> server. The client role is to connect, and then to print the
> notification which comes from the server until the server says "stop"
> Does someone knows how to make the for loop work with data coming from
> network requests?
Maybe you've got bigger things in mind, but I don't know what all of
that buys you, at least from your example use case (client connects,
prints response from server, quits on 'stop'). What's wrong with keeping
it simple and handling responses in the Protocol?
def lineReceived(self, line):
if line == 'stop':
More information about the Twisted-Python