[Twisted-Python] Noob Question

Shelby Ramsey sicfslist at gmail.com
Sat Mar 14 17:12:49 EDT 2009


Peter,

Thanks for the help.  Yes I get a header and then am looking to extract the
body.

So to make sure I understand:

p = compile('Content-Length:\s(\d+)')

class SomeClient(basic.LineReceiver):
    def connectionMade(self):
        self.transport.write('login: info\r\n\r\n') # log in ... then device
starts sending events

    def lineReceived(self, line):
        m = p.findall(line)
        if m:
            self.body_length = m[0]
            self.setRawMode()

     def rawDataReceived(self, data):
         self.get_rest -= len(data)
         set.lineMode()

Should something along those lines work?

David / Peter ... thanks again for the assistance!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20090314/2b90fd9a/attachment.htm 


More information about the Twisted-Python mailing list