urllib2, proxies and https

Discussion in 'Python' started by Astan Chee, Aug 18, 2006.

  1. Astan Chee

    Astan Chee Guest

    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/3507227/urllib2_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
     
    Astan Chee, Aug 18, 2006
    #1
    1. Advertising

  2. Astan Chee

    John J. Lee Guest

    Astan Chee <> writes:

    > 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/3507227/urllib2_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
     
    John J. Lee, Aug 20, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Fuzzyman

    urllib2, https, and proxies

    Fuzzyman, Jun 29, 2005, in forum: Python
    Replies:
    0
    Views:
    407
    Fuzzyman
    Jun 29, 2005
  2. tomazi75-nospam(at)gmail.com

    urllib2 and proxies support ?

    tomazi75-nospam(at)gmail.com, Jan 4, 2006, in forum: Python
    Replies:
    1
    Views:
    376
  3. Replies:
    0
    Views:
    789
  4. Mani Ghasemlou

    urllib2, proxies, and pac files on OS X

    Mani Ghasemlou, Mar 30, 2009, in forum: Python
    Replies:
    0
    Views:
    315
    Mani Ghasemlou
    Mar 30, 2009
  5. tvashtar
    Replies:
    17
    Views:
    977
Loading...

Share This Page