blob: e26d9aed662c7d32346fe018d1203e50806c8c97 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
Description: Make Python import system know that requests.packages.urllib3 and
urllib3 are the same thing.
Author: Jakub Wilk <jwilk@debian.org>
Forwarded: not-needed
Bug-Debian: https://bugs.debian.org/769047
Last-Update: 2014-11-05
--- a/requests/__init__.py
+++ b/requests/__init__.py
@@ -48,6 +48,24 @@
__license__ = 'Apache 2.0'
__copyright__ = 'Copyright 2014 Kenneth Reitz'
+# On Debian make Python import system know that requests.packages.urllib3
+# and urllib3 are the same thing.
+import pkgutil
+import sys
+import urllib3
+
+def _attach_namespace(package, where):
+ for loader, name, ispkg in pkgutil.walk_packages(package.__path__,
+ package.__name__ + '.'):
+ try:
+ module = __import__(name)
+ except ImportError:
+ continue
+ sys.modules[where + '.' + name] = module
+
+_attach_namespace(urllib3, 'requests.packages')
+del _attach_namespace
+
# Attempt to enable urllib3's SNI support, if possible
try:
from urllib3.contrib import pyopenssl
|