Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 042e3f7

Browse files
committed
bug fix for a bug reported by nightman (RuntimeError: maximum recursion depth exceeded)
1 parent 7ae5192 commit 042e3f7

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

lib/request/basicauthhandler.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class SmartHTTPBasicAuthHandler(urllib2.HTTPBasicAuthHandler):
1616
"""
1717
def __init__(self, *args, **kwargs):
1818
urllib2.HTTPBasicAuthHandler.__init__(self, *args, **kwargs)
19-
self.retried_req = None
19+
self.retried_req = []
2020

2121
def reset_retry_count(self):
2222
# Python 2.6.5 will call this on 401 or 407 errors and thus loop
@@ -26,8 +26,8 @@ def reset_retry_count(self):
2626

2727
def http_error_auth_reqed(self, auth_header, host, req, headers):
2828
# Reset the retry counter once for each request.
29-
if req is not self.retried_req:
30-
self.retried_req = req
29+
if req not in self.retried_req:
30+
self.retried_req.append(req)
3131
self.retried = 0
3232
return urllib2.HTTPBasicAuthHandler.http_error_auth_reqed(
3333
self, auth_header, host, req, headers)

0 commit comments

Comments
 (0)