You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
542 B

4 years ago
  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?