C
cp.finances.gouv
Hello all,
I'm facing a strange behavior of urllib2 trying to access gmail
account behind a proxy (Squid).
The following works perfectly :
wget --save-cookies cookies --keep-session-cookies --post-
data="[email protected]&Passwd=cpfinances" --no-
check-certificate -O - https://www.google.com/accounts/ServiceLoginBoxAuth
While the following urllib2 code fail with an error 501 :
In [18]: import urllib2
In [19]: r=urllib2.urlopen("https://www.google.com/accounts/
ServiceLoginBoxAuth",
"[email protected]&Passwd=cpfinances")
---------------------------------------------------------------------------
urllib2.HTTPError Traceback (most
recent call last)
/home/maric/<ipython console>
/home/maric/urllib2.py in urlopen(url, data)
128 if _opener is None:
129 _opener = build_opener()
--> 130 return _opener.open(url, data)
....
/home/maric/urllib2.py in http_error_default(self, req, fp, code, msg,
hdrs)
478 class HTTPDefaultErrorHandler(BaseHandler):
479 def http_error_default(self, req, fp, code, msg, hdrs):
--> 480 raise HTTPError(req.get_full_url(), code, msg, hdrs,
fp)
481
482 class HTTPRedirectHandler(BaseHandler):
HTTPError: HTTP Error 501: Not Implemented
I understood it's a response from the proxy about incompatible
protocols and queries but this seem rather strange in this case. Could
there be a bug in the ProxyHandler class ? Any idea about what could
cause this error on the proxy ?
I'm facing a strange behavior of urllib2 trying to access gmail
account behind a proxy (Squid).
The following works perfectly :
wget --save-cookies cookies --keep-session-cookies --post-
data="[email protected]&Passwd=cpfinances" --no-
check-certificate -O - https://www.google.com/accounts/ServiceLoginBoxAuth
While the following urllib2 code fail with an error 501 :
In [18]: import urllib2
In [19]: r=urllib2.urlopen("https://www.google.com/accounts/
ServiceLoginBoxAuth",
"[email protected]&Passwd=cpfinances")
---------------------------------------------------------------------------
urllib2.HTTPError Traceback (most
recent call last)
/home/maric/<ipython console>
/home/maric/urllib2.py in urlopen(url, data)
128 if _opener is None:
129 _opener = build_opener()
--> 130 return _opener.open(url, data)
....
/home/maric/urllib2.py in http_error_default(self, req, fp, code, msg,
hdrs)
478 class HTTPDefaultErrorHandler(BaseHandler):
479 def http_error_default(self, req, fp, code, msg, hdrs):
--> 480 raise HTTPError(req.get_full_url(), code, msg, hdrs,
fp)
481
482 class HTTPRedirectHandler(BaseHandler):
HTTPError: HTTP Error 501: Not Implemented
I understood it's a response from the proxy about incompatible
protocols and queries but this seem rather strange in this case. Could
there be a bug in the ProxyHandler class ? Any idea about what could
cause this error on the proxy ?