summaryrefslogtreecommitdiffstats
path: root/Lib/urllib.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/urllib.py')
-rw-r--r--Lib/urllib.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/Lib/urllib.py b/Lib/urllib.py
index d028d7a..2d53c12 100644
--- a/Lib/urllib.py
+++ b/Lib/urllib.py
@@ -63,15 +63,20 @@ else:
# Shortcut for basic usage
_urlopener = None
-def urlopen(url, data=None):
+def urlopen(url, data=None, proxies=None):
"""urlopen(url [, data]) -> open file-like object"""
global _urlopener
- if not _urlopener:
- _urlopener = FancyURLopener()
+ if proxies is not None:
+ opener = FancyURLopener(proxies=proxies)
+ elif not _urlopener:
+ opener = FancyURLopener()
+ _urlopener = opener
+ else:
+ opener = _urlopener
if data is None:
- return _urlopener.open(url)
+ return opener.open(url)
else:
- return _urlopener.open(url, data)
+ return opener.open(url, data)
def urlretrieve(url, filename=None, reporthook=None, data=None):
global _urlopener
if not _urlopener: