I have a trouble of connecting to a website using httplib2. My computer is behind a firewall and, as https://code.google.com/p/httplib2/wiki/Examples suggests, I did as follows:
import httplib2
from httplib2 import socks
http = httplib2.Http(proxy_info = httplib2.ProxyInfo(socks.PROXY_TYPE_HTTP, <proxy host address>, 8080, proxy_user = <proxy user id>, proxy_pass = <proxy password>))
resp, content = http.request("http://google.com", "GET")
But, I am still getting
httplib2.ServerNotFoundError: Unable to find the server at google.com
My computer works fine with urllib2. Can anybody help me?
You can try using "PROXY_TYPE_HTTP_NO_TUNNEL" if your server requires no tunneling
import httplib2
http = httplib2.Http(proxy_info = httplib2.ProxyInfo(httplib2.socks.PROXY_TYPE_HTTP_NO_TUNNEL, 'proxy.example.com', 8080, proxy_user = 'username', proxy_pass = 'password') )
resp, content = http.request("http://google.com", "GET")
It was a known bug that was fixed due to an issue #38
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With