packages.py 542 B

123456789101112131415
  1. import sys
  2. # This code exists for backwards compatibility reasons.
  3. # I don't like it either. Just look the other way. :)
  4. for package in ('urllib3', 'idna', 'chardet'):
  5. locals()[package] = __import__(package)
  6. # This traversal is apparently necessary such that the identities are
  7. # preserved (requests.packages.urllib3.* is urllib3.*)
  8. for mod in list(sys.modules):
  9. if mod == package or mod.startswith(package + '.'):
  10. sys.modules['requests.packages.' + mod] = sys.modules[mod]
  11. # Kinda cool, though, right?