projects
/
services
/
python-requests.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a718a81
)
A fix for #1979 repeat HTTP digest authentication after redirect.
author
Yossi Gottlieb
<yossigo@gmail.com>
Sat, 27 Sep 2014 17:42:58 +0000
(20:42 +0300)
committer
Yossi Gottlieb
<yossigo@gmail.com>
Sat, 27 Sep 2014 18:05:59 +0000
(21:05 +0300)
requests/auth.py
patch
|
blob
|
history
diff --git
a/requests/auth.py
b/requests/auth.py
index 9b6426dc06603ce4f661acfe6c92da486122fd45..41be982995cd672b62ff64430fc80914b1e0e04e 100644
(file)
--- a/
requests/auth.py
+++ b/
requests/auth.py
@@
-150,6
+150,14
@@
class HTTPDigestAuth(AuthBase):
return 'Digest %s' % (base)
+ def handle_302(self, r, **kwargs):
+ """Reset num_401_calls counter on redirects."""
+ try:
+ delattr(self, 'num_401_calls')
+ except AttributeError:
+ pass
+ return r
+
def handle_401(self, r, **kwargs):
"""Takes the given response and tries digest-auth, if needed."""
@@
-194,4
+202,5
@@
class HTTPDigestAuth(AuthBase):
except AttributeError:
pass
r.register_hook('response', self.handle_401)
+ r.register_hook('response', self.handle_302)
return r