kennethreitz/requests — pull request #1123 by andrewjesaitis (2013-01-21 23:56:28+00:00)
Title: Fixes DigestAuth with Sessions

Currently if you try to use digest auth with a bad username and password, you will enter a infinite loop of 401s. I think this is due to the handle_401 method overwriting the current registered hook, which in the context of #1106 is the correct behavior. This means that we can't just count the registered hooks.

I added a counter to the request object, but am not sure if this fits with the way the rest of the library is structured since I am not too familiar with the rest of the codebase. If you have better idea of how this should be implemented, I'd be happy to do it!