Clean up handle_redirect.
authorYossi Gottlieb <yossigo@gmail.com>
Thu, 23 Oct 2014 10:46:44 +0000 (13:46 +0300)
committerYossi Gottlieb <yossigo@gmail.com>
Thu, 23 Oct 2014 10:46:44 +0000 (13:46 +0300)
requests/auth.py

index b2b341f5cb913d7be466e30e14a3b594b47654a4..010919f31f55f96948053941038031f42656b763 100644 (file)
@@ -153,9 +153,7 @@ class HTTPDigestAuth(AuthBase):
 
     def handle_redirect(self, r, **kwargs):
         """Reset num_401_calls counter on redirects."""
-        if r.status_code in (
-                codes.temporary_redirect,
-                codes.permanent_redirect):
+        if r.is_redirect:
             setattr(self, 'num_401_calls', 1)
 
     def handle_401(self, r, **kwargs):