def http_error_401(self, *args): response = HTTPBasicAuthHandler.http_error_401(self, *args) self.retried = 0 return response