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.
The problem is I don't have a clue how to use digest auth with twisted.web.client. Couln't find any code examples for this. Can somebody help me with this? ( I'm not a python programmer so please be gentle) 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 BeginPrint(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(BeginPrint(finished)) return finished d.addCallback(cbResponse) reactor.run() _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor