468,321 Members | 1,817 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,321 developers. It's quick & easy.

urllib2, proxies and https

Hi again,
According to
https://demo.launchpad.net/products/python/+bug/56872
or more specifically, the example of its working code:
http://librarian.demo.launchpad.net/..._proxy_auth.py
I can use urllib2 via proxy to access a https site(specifically hooking
it up to libgmail).
The problem is that the proxy that is accessible to me is http/port8080
only. Is it possible to use urllib2 with this proxy to access a https
site? (im guessing no, but im sure there are ways around it).
I've tried modifying the code to point to a https site
(https://mail.google.com/mail/) without changing the http proxy and it
produces a HTTP timeout error.
Despite this, if I manually use a web browser to access these sites it
prompts me with the proxy login and lets me through. So im also puzzled
here why my browser lets this happen but urllib2 doesnt.
Thanks again for all your help.
Cheers
Astan

Aug 18 '06 #1
1 2647
Astan Chee <st***@al.com.auwrites:
Hi again,
According to
https://demo.launchpad.net/products/python/+bug/56872
or more specifically, the example of its working code:
http://librarian.demo.launchpad.net/..._proxy_auth.py
I can use urllib2 via proxy to access a https site(specifically
hooking it up to libgmail).
[...]

The code at that URL seems to be claiming you CAN'T do that, even with
HTTP URLs (note HTTP, not HTTPS). Hopefully (s)he is complaining
about 2.4 -- there are a bunch of bugs with this kind of thing fixed
in Python 2.5.

Re HTTPS: urllib2 does not support the CONNECT method (nor urllib, I
think), so no, you can't visit HTTPS URLS through a proxy with vanilla
urllib2. There are some hacks lying around in the cookbook and on the
Python SF tracker showing how to do it, though.
John
Aug 20 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by O. Koch | last post: by
2 posts views Thread by Derek Fountain | last post: by
4 posts views Thread by Fuzzyman | last post: by
reply views Thread by Fuzzyman | last post: by
1 post views Thread by Ray Slakinski | last post: by
1 post views Thread by tomazi75-nospam(at)gmail.com | last post: by
1 post views Thread by dmbkiwi | last post: by
6 posts views Thread by Alejandro Dubrovsky | last post: by
reply views Thread by Ali.Sabil | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.