[Twisted-web] Twisted web client digest authentication?
exarkun at twistedmatrix.com
exarkun at twistedmatrix.com
Mon Dec 5 08:51:34 EST 2011
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()
>_______________________________________________
>Twisted-web mailing list
>Twisted-web at twistedmatrix.com
>http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
More information about the Twisted-web
mailing list