Skip to content
Myr

Merge pull request #3760 from sigmavirus24/deprecation-warning

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

Add deprecation warnings for 3.0

authored by Cory Benfield · committed by GitHub · parents 449d748, fae6701 · Browse files · 2 files+17 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

2 files+17 added−1 removed

  • tests:+2 added−1 removed
  • other:+15 added−0 removed

2 files+17 added−1 removed

modified:requests/auth.py+15 added
10 unmodified lines
11import re12import time13import hashlib14import threading15import warnings1617from base64 import b64encode1819from .compat import urlparse, str, basestring
16 unmodified lines
36 #37 # These are here solely to maintain backwards compatibility38 # for things like ints. This will be removed in 3.0.0.39 if not isinstance(username, basestring):40 warnings.warn(41 "Non-string usernames will no longer be supported in Requests "42 "3.0.0. Please convert the object you've passed in ({!r}) to "43 "a string or bytes object in the near future to avoid "44 "problems.".format(username),45 category=DeprecationWarning,46 )47 username = str(username)4849 if not isinstance(password, basestring):50 warnings.warn(51 "Non-string passwords will no longer be supported in Requests "52 "3.0.0. Please convert the object you've passed in ({!r}) to "53 "a string or bytes object in the near future to avoid "54 "problems.".format(password),55 category=DeprecationWarning,56 )57 password = str(password)58 # -- End Removal --5960 if isinstance(username, str):
228 unmodified lines
modified:tests/test_requests.py+2 added-1 removed
482 unmodified lines
483 @pytest.mark.parametrize(484 'username, password', (485 ('user', 'pass'),486 (u'имя'.encode('utf-8'), u'пароль'.encode('utf-8')),487 (42, 42)487 (42, 42),488 (None, None),489 ))490 def test_set_basicauth(self, httpbin, username, password):491 auth = (username, password)492 url = httpbin('get')
1804 unmodified lines