--- Lib/urllib2-old.py 2010-07-22 11:24:18.000000000 +0200 +++ Lib/urllib2-new.py 2010-07-22 11:52:47.000000000 +0200 @@ -839,7 +839,10 @@ if mo: scheme, quote, realm = mo.groups() if scheme.lower() == 'basic': - return self.retry_http_basic_auth(host, req, realm) + response = self.retry_http_basic_auth(host, req, realm) + if response.status != 401: + self.retried = 0 + return response def retry_http_basic_auth(self, host, req, realm): user, pw = self.passwd.find_user_password(realm, host)