Skip to content
Myr

more advanced authentication mechanism

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

authored by Kenneth Reitz · committed by Kenneth Reitz · parent 495c3d5 · Browse files · 1 file+29 added−1 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+29 added−1 removed

  • other:+29 added−1 removed

1 file+29 added−1 removed

modified:requests/auth.py+29 added-1 removed
26 unmodified lines
27 """Attaches HTTP Digest Authentication to the given Request object.28 Arguments should be considered non-positional.29 """3031 r.headers31 r.headers323334def dispatch(t):35 """Given an auth tuple, return an expanded version."""3637 if not t:38 return t39 else:40 t = list(t)4142 # Make sure they're passing in something.43 assert len(t) <= 24445 # If only two items are passed in, assume HTTPBasic.46 if (len(t) == 2):47 t.insert(0, 'basic')4849 # Allow built-in string referenced auths.50 if isinstance(t[0], basestring):51 if t[0] in ('basic', 'forced_basic'):52 t[0] = http_basic53 elif t[0] in ('digest',):54 t[0] = http_digest5556 # Return a custom callable.57 return (t[0], t[1:])5859