Merge branch 'master' into proposed/3.0.0

This commit is contained in:
Cory Benfield
2016-12-09 14:49:18 +00:00
2 changed files with 17 additions and 1 deletions
+15
View File
@@ -12,6 +12,7 @@ import re
import time
import hashlib
import threading
import warnings
from base64 import b64encode
@@ -36,9 +37,23 @@ def _basic_auth_str(username, password):
# These are here solely to maintain backwards compatibility
# for things like ints. This will be removed in 3.0.0.
if not isinstance(username, basestring):
warnings.warn(
"Non-string usernames will no longer be supported in Requests "
"3.0.0. Please convert the object you've passed in ({!r}) to "
"a string or bytes object in the near future to avoid "
"problems.".format(username),
category=DeprecationWarning,
)
username = str(username)
if not isinstance(password, basestring):
warnings.warn(
"Non-string passwords will no longer be supported in Requests "
"3.0.0. Please convert the object you've passed in ({!r}) to "
"a string or bytes object in the near future to avoid "
"problems.".format(password),
category=DeprecationWarning,
)
password = str(password)
# -- End Removal --
+2 -1
View File
@@ -514,7 +514,8 @@ class TestRequests:
'username, password', (
('user', 'pass'),
(u'имя'.encode('utf-8'), u'пароль'.encode('utf-8')),
(42, 42)
(42, 42),
(None, None),
))
def test_set_basicauth(self, httpbin, username, password):
auth = (username, password)