proxy in urlopen()

Egor Bolonev ebolonev at bonbon.net
Tue May 18 03:53:54 EDT 2004


how they define proxy in urlopen? i've tried

a=urlopen('url', proxies=('127.0.0.1:3128'))
a=urlopen('url', proxies='127.0.0.1:3128')

but it says there is an error

==================================
Traceback (most recent call last):
   File "getlinks.py", line 3, in ?
     a=urlopen('http://forum.octopusnet.lan/',  
proxies='127.0.0.1:3128').read()
   File "C:\Python23\lib\urllib.py", line 69, in urlopen
     opener = FancyURLopener(proxies=proxies)
   File "C:\Python23\lib\urllib.py", line 544, in __init__
     URLopener.__init__(self, *args, **kwargs)
   File "C:\Python23\lib\urllib.py", line 106, in __init__
     assert hasattr(proxies, 'has_key'), "proxies must be a mapping"
AssertionError: proxies must be a mapping
Exception exceptions.AttributeError: "FancyURLopener instance has no  
attribute 'tempcache'" in <bound method FancyURLopener.__del__ of  
<urllib.FancyURLopener instance at 0x00909210>> ignored
==================================



More information about the Python-list mailing list