Skip to content
Myr

Unable unicode in basic http auth

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

Fixed the issue with unicode characters in basic http auth

authored by Dmitry Klimenko · committed by GitHub · parent 70f1f8e · Browse files · 1 file+7 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+7 added−1 removed

  • other:+7 added−1 removed

1 file+7 added−1 removed

modified:requests/auth.py+7 added-1 removed
13 unmodified lines
14import threading1516from base64 import b64encode1718from .compat import urlparse, str18from .compat import urlparse, str, bytes19from .cookies import extract_cookies_to_jar20from ._internal_utils import to_native_string21from .utils import parse_dict_header22from .status_codes import codes
3 unmodified lines
262728def _basic_auth_str(username, password):29 """Returns a Basic Auth string."""30 31 if isinstance(username, bytes):32 username = username.decode('latin1')3334 if isinstance(password, bytes):35 password = password.decode('latin1')3637 authstr = 'Basic ' + to_native_string(38 b64encode(('%s:%s' % (username, password)).encode('latin1')).strip()39 )40
219 unmodified lines