From: Guido van Rossum Date: Tue, 18 Nov 1997 15:50:39 +0000 (+0000) Subject: Assert that the proxies object passed in to the URLopener constructor X-Git-Tag: v1.5b1~88 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=83600050d0aacd17e10f426881394237aca79f8e;p=python Assert that the proxies object passed in to the URLopener constructor is indeed a dictionary (or a mapping). --- diff --git a/Lib/urllib.py b/Lib/urllib.py index a818adfd58..02edb3b265 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)]