[Twisted-web] Twisted web client digest authentication?

Paul de Vries pc.vries at tip.nl
Mon Dec 5 09:24:57 EST 2011

Thanks for setting me on the right track.  This is the first and (so far) only response I got
so I supposed it was a stupid or impossible question.  
Which is very likely because I'm new to python and twisted.


Op 5 dec 2011, om 14:51 heeft exarkun at twistedmatrix.com het volgende geschreven:

> On 2 Dec, 02:31 pm, pc.vries at tip.nl wrote:
>> 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?
> Digest authentication is performed in the headers of requests and 
> responses.  The server sends a challenge, the client computes a response 
> proving they know a secret only one user is supposed to know.
>> [snip]
>> def cbResponse(response):
> The response object has all of the headers sent from the server.  You 
> can inspect them and then compute the appropriate challenge response to 
> include in your *next* request.  If you get it right, then the server 
> will give you the content instead of sending you a challenge.
> Some work has been done on adding higher-level support for this feature 
> to Twisted, but it is not yet complete.  You can follow its progress or 
> pitch in at <http://twistedmatrix.com/trac/ticket/5148>.
> Jean-Paul
>>   print 'Response version: ', response.version
>>   finished = Deferred()
>>   response.deliverBody(ParseReceived(finished))
>>   return finished
>> d.addCallback(cbResponse)
>> reactor.run()
>> _______________________________________________

More information about the Twisted-web mailing list