Twisted web client digest authentication?

Paul de Vries <[email protected]>
Newsgroups gmane.comp.python.twisted.web
Message-ID <[email protected]>
Hi

Made something that connects to a httpserver and parses the xml stream it sends.
The webserver it has to connect to uses digest authentication.

How can I implement digest authentication in this?

thanks in advance

the code I put together:

from twisted.internet import  reactor
from twisted.internet.defer import Deferred
from twisted.internet.protocol import Protocol
from twisted.web.client import Agent
from twisted.web.http_headers import Headers
from StringIO import StringIO
from elementtree import ElementTree


class ParseReceived(Protocol):
    def __init__(self, finished):
        self.finished = finished
        self.dataStream = StringIO()

    def dataReceived(self, bytes):
        display = bytes
        #print 'some data received:'
        #print display
        context = ElementTree.iterparse(StringIO(bytes), events = ("start", "end"))
        context = iter(context)
        event, root = context.next()
        
        for event, elem in context:
            if elem.tag == "Tag":
                print "Tag "
            root.clear()
            

    def connectionLost(self, reason):
        print 'finished receiving', reason.getErrorMessage()

agent = Agent(reactor)

d = agent.request('GET', 'http:someadress', Headers({'User-Agent': ['Twisted web client']}), None)

def cbResponse(response):
    print 'Response version: ', response.version
    finished = Deferred()
    response.deliverBody(ParseReceived(finished))
    return finished

d.addCallback(cbResponse)
reactor.run()
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.