I am using an http proxy and the Mechanize module. I initialize the mechanize object and set the proxy like so:
self.br = mechanize.Browser()
self.br.set_proxies({"http": proxyAddress}) #proxy address is like 1.1.1.1:8080
Then I open the site like so:
response = self.br.open("http://google.com")
My problem is that mechanize seems to be completely ignoring the proxy. If I debug and inspect the br object, under the proxy handler I can see my proxy settings. However, even if I give a bad proxy Mechanize just goes about its business like I never set a proxy. What gives?
edit: I have also tried:
mechanize.install_opener(mechanize.build_opener(mechanize.ProxyHandler({'http': "127.0.0.1:99"})))
response = mechanize.urlopen("http://google.com")
And it seems to be ignoring my proxy as well. (I didn't even give it a valid proxy, shouldn't it fail on a URLError?)
Figured it out after talking on the email list:
If if you are trying to access https site then set proxy as https as follow br = mechanize.Browser()