Skip to content
Myr

Add equality functions for authentication handlers

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Nicolas Delvaux · committed by Nicolas Delvaux · parent cbb0830 · Browse files · 1 file+22 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+22 added−0 removed

  • other:+22 added−0 removed

1 file+22 added−0 removed

modified:requests/auth.py+22 added
45 unmodified lines
46 def __init__(self, username, password):47 self.username = username48 self.password = password4950 def __eq__(self, other):51 if not isinstance(other, HTTPBasicAuth):52 return NotImplemented53 return self.username == other.username and self.password == other.password5455 def __ne__(self, other):56 return not self == other5758 def __call__(self, r):59 r.headers['Authorization'] = _basic_auth_str(self.username, self.password)60 return r61
166 unmodified lines
228 r.register_hook('response', self.handle_redirect)229 self._thread_local.num_401_calls = 1230231 return r232233 def __eq__(self, other):234 if not isinstance(other, HTTPDigestAuth):235 return NotImplemented236 return self.username == other.username and \237 self.password == other.password and \238 self.last_nonce == other.last_nonce and \239 self.nonce_count == other.nonce_count and \240 self.chal == other.chal and \241 self.pos == other.pos and \242 self.num_401_calls == other.num_401_calls243244 def __ne__(self, other):245 return not self == other