views:

176

answers:

2

I read somewhere that currently urllib2 doesn't support authenticated https connection. My proxy uses a basic authentication only, but how to open an https based webpage through it . Please help me.

Thanks.

A: 

You can use httplib2, which solves some of the limitations of urllib2 including this one. There is an example here of how to do Basic Authentication on a https connection.

dF
+1  A: 

"urllib2 doesn't support authenticated https connection" False.

    # Build Handler to support HTTP Basic Authentication...
    basic_handler = urllib2.HTTPBasicAuthHandler()
    basic_handler.add_password(realm, self.urlBase, username, password)
    # Get cookies, also, to handle login
    self.cookies= cookielib.CookieJar()
    cookie_handler= urllib2.HTTPCookieProcessor( self.cookies )
    # Assemble the final opener
    opener = urllib2.build_opener(basic_handler,cookie_handler)
S.Lott