summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-11-18 15:50:39 (GMT)
committerGuido van Rossum <guido@python.org>1997-11-18 15:50:39 (GMT)
commit83600050d0aacd17e10f426881394237aca79f8e (patch)
treedd9b57c6c2bde3fac4901e706306eca8b2ff2d5b
parent421c2240445f4f3b9a6233064bc16f42633101f7 (diff)
downloadcpython-83600050d0aacd17e10f426881394237aca79f8e.zip
cpython-83600050d0aacd17e10f426881394237aca79f8e.tar.gz
cpython-83600050d0aacd17e10f426881394237aca79f8e.tar.bz2
Assert that the proxies object passed in to the URLopener constructor
is indeed a dictionary (or a mapping).
-rw-r--r--Lib/urllib.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/Lib/urllib.py b/Lib/urllib.py
index a818adf..02edb3b 100644
--- a/Lib/urllib.py
+++ b/Lib/urllib.py
@@ -87,6 +87,7 @@ class URLopener:
def __init__(self, proxies=None):
if proxies is None:
proxies = getproxies()
+ assert hasattr(proxies, 'has_key'), "proxies must be a mapping"
self.proxies = proxies
server_version = "Python-urllib/%s" % __version__
self.addheaders = [('User-agent', server_version)]