mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Assert that the proxies object passed in to the URLopener constructor
is indeed a dictionary (or a mapping).
This commit is contained in:
parent
421c224044
commit
83600050d0
1 changed files with 1 additions and 0 deletions
|
@ -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)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue