I try to use urllib2 to send http request via a proxy server but unfortunately I can not make it done.
proxy_server = {"http":"86.51.26.13:8080"}
proxy = urllib2.ProxyHandler(proxy_server)
opener = urllib2.build_opener(proxy)
urllib2.install_opener(opener)
response = urllib2.urlopen("http://www.whatismyip.com/").read()
print response
The error I get using the code above is:
urllib2.HTTPError: HTTP Error 403: Forbidden
The proxy server is alright(I can use it in Firefox). Moreover, I wont see any communication(Wireshark) with my computer to the destination address something that really weird(how does urllib2 determine the http error code?)
Any suggestions?