Skip to content
Myr

fix base64 encoding for httpbasic

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

  • other:+2 added−2 removed

1 file+2 added−2 removed

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