urllib fails to connect

Edwin.Madari at VerizonWireless.com Edwin.Madari at VerizonWireless.com
Wed Aug 20 22:23:21 CEST 2008

jlist wrote:
> I found out why. I set a proxy in IE and I didn't know
> ActiveState Python use IE proxy!
> > I'm running ActiveState Python 2.5 on Windows XP. It used
> > to work fine. Today however I get (10061, 'Connection refused')
> > for any site I try with urllib.urlopen().

switching to urllib2, installing the proxy opener, worked for me. 
here is the sample. variable names are self explanatory

import urllib2
opener=urllib2.build_opener(proxy, urllib2.HTTPHandler)
req = urllib2.Request(url, form, headers)
fd = urllib2.urlopen(req)
print fd.code, fd.info(), fd.read()


The information contained in this message and any attachment may be
proprietary, confidential, and privileged or subject to the work
product doctrine and thus protected from disclosure.  If the reader
of this message is not the intended recipient, or an employee or
agent responsible for delivering this message to the intended
recipient, you are hereby notified that any dissemination,
distribution or copying of this communication is strictly prohibited.
If you have received this communication in error, please notify me
immediately by replying to this message and deleting it and all
copies and backups thereof.  Thank you.

More information about the Python-list mailing list