Message98401
Well, following your description I've backed out my urllib2 test case to this:
f = urllib2.urlopen('https://localhost/boguspath')
os.system("lsof -p %d | grep IPv4" % (os.getpid(),))
f = urllib2.urlopen(R)
print f.read()
and it happily runs HTTPS through the proxy if I set the https_proxy envvar. So it's all well and good for the "just do what the environment suggests" use case.
However, my older test:
U = urllib2.Request('https://localhost/boguspath')
U.set_proxy('localhost:3128', 'https')
f = urllib2.urlopen(R)
print f.read()
still blows up with:
File "/opt/python-2.6.4/lib/python2.6/urllib2.py", line 381, in open
protocol = req.get_type()
AttributeError: HTTPResponse instance has no attribute 'get_type'
Now, this is the use case for "I have a custom proxy setup for this activity".
It seems a little dd that "req" above is an HTTPResponse instead of a Request, and that my be why there's no .ettype() method available.
I also see nothing obviously wrong with my set_proxy() call above based on the docs for the .set_proxy() method, though obviously it fails.
I think what may be needed is a small expansion of the section in the Examples are on proxies. There's an description of the use of the *_proxy envvars there (and not elsewhere, which seems wrong) and an example of providing a proxy Handler. An addition example with a functioning use of a bare .set_proxy() might help. |
|
Date |
User |
Action |
Args |
2010-01-27 03:07:00 | cameron | set | recipients:
+ cameron, orsenthil, brian.curtin |
2010-01-27 03:06:59 | cameron | set | messageid: <1264561619.83.0.843273376884.issue7776@psf.upfronthosting.co.za> |
2010-01-27 03:06:57 | cameron | link | issue7776 messages |
2010-01-27 03:06:55 | cameron | create | |
|