I am trying to set an http proxy when creating a mechanize broswer instance but it doesn't seem to be working at all or throwing any kind of errors.
from mechanize import Browser
br = Browser()
ua = 'Mozilla/5.0 (X11; Linux x86_64; rv:18.0) Gecko/20100101 Firefox/1 8.0 (compatible;)'
br.addheaders = [('User-Agent', ua), ('Accept', '*/*')]
br.set_proxies({'http':'116.226.11.254:8118'})
br.open("https://xxx.xxx")
This code still opens the url with local ip and doesn't use the proxy at all. If proxy were unreachable then it should have thrown such error but its not happening. I tried to put in some invalid ip for proxy like
br.set_proxies({'http':'116.22as6.11.25as4:8118'})
but this code doesnt throw any error too!! Is is possible that some other inbuild python code is re-writing proxy? I am using python 2.7.10 inside a virtual environment with latest mechanize, and trying to open an https address with this code
I have tried this but it still ignores proxy