Skip to content
Myr

httpbasic authentication cleanup

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 94c587d · Browse files · 1 file+4 added−2 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+4 added−2 removed

  • other:+4 added−2 removed

1 file+4 added−2 removed

modified:requests/auth.py+4 added-2 removed
5 unmodified lines
67This module contains the authentication handlers for Requests.8"""910from base64 import encodestring as base6410from base64 import base641112def http_basic(r, username, password):13 """Attaches HTTP Basic Authentication to the given Request object.14 Arguments should be considered non-positional.1516 """17 username = str(username)18 password = str(password)1918 auth_s = base64('%s:%s' % (username, password)).replace('\n', '')20 auth_s = base64('%s:%s' % (username, password))21 r.headers['Authorization'] = ('Basic %s' % auth_s)2223 return r24
7 unmodified lines