Fix requests.packages not having package attributes

Fixes #4104
This commit is contained in:
Ryan Pineo
2017-05-29 17:25:56 -04:00
parent 2d763c90ae
commit 1278ecdf71
3 changed files with 15 additions and 1 deletions
+1
View File
@@ -182,3 +182,4 @@ Patches and Suggestions
- David Fontenot (`@davidfontenot <https://github.com/davidfontenot>`_)
- Shmuel Amar (`@shmuelamar <https://github.com/shmuelamar>`_)
- Gary Wu (`@garywu <https://github.com/garywu>`_)
- Ryan Pineo (`@ryanpineo <https://github.com/ryanpineo>`_)
+1 -1
View File
@@ -4,7 +4,7 @@ import sys
# I don't like it either. Just look the other way. :)
for package in ('urllib3', 'idna', 'chardet'):
__import__(package)
locals()[package] = __import__(package)
# This traversal is apparently necessary such that the identities are
# preserved (requests.packages.urllib3.* is urllib3.*)
for mod in list(sys.modules):
+13
View File
@@ -0,0 +1,13 @@
import requests
def test_can_access_urllib3_attribute():
requests.packages.urllib3
def test_can_access_idna_attribute():
requests.packages.idna
def test_can_access_chardet_attribute():
requests.packages.chardet