Skip to content
Myr

Merge pull request #4106 from silverlogic/master

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

Fix requests.packages not having package attributes

authored by Kenneth Reitz · committed by GitHub · parents 2d763c9, 1278ecd · Browse files · 3 files+15 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

3 files+15 added−1 removed

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

3 files+15 added−1 removed

modified:requests/packages.py+1 added-1 removed
2 unmodified lines
3# This code exists for backwards compatibility reasons.4# I don't like it either. Just look the other way. :)56for package in ('urllib3', 'idna', 'chardet'):7 __import__(package)7 locals()[package] = __import__(package)8 # This traversal is apparently necessary such that the identities are9 # preserved (requests.packages.urllib3.* is urllib3.*)10 for mod in list(sys.modules):11 if mod == package or mod.startswith(package + '.'):
3 unmodified lines
added:tests/test_packages.py+13 added
1import requests234def test_can_access_urllib3_attribute():5 requests.packages.urllib3678def test_can_access_idna_attribute():9 requests.packages.idna101112def test_can_access_chardet_attribute():13 requests.packages.chardet
modified:AUTHORS.rst+1 added
180 unmodified lines
181- Jonathan Vanasco (`@jvanasco <https://github.com/jvanasco>`_)182- David Fontenot (`@davidfontenot <https://github.com/davidfontenot>`_)183- Shmuel Amar (`@shmuelamar <https://github.com/shmuelamar>`_)184- Gary Wu (`@garywu <https://github.com/garywu>`_)185- Ryan Pineo (`@ryanpineo <https://github.com/ryanpineo>`_)