Python mechanize doesn't work when HTTPS and Proxy Authentication required

后端 未结 1 786
迷失自我
迷失自我 2021-01-06 18:31

I use Python 2.7.2 and Mechanize 0.2.5.
When I access the Internet, I have to go through a proxy server. I wrote the following codes, but an URLError occurred at the las

相关标签:
1条回答
  • 2021-01-06 19:01

    I don't recommend you to use Mechanize, it's outdated. Take a look at requests it will make your life a lot easier. Using proxies with requests it's just this:

    import requests
    
    proxies = {
      "http": "10.10.1.10:3128",
      "https": "10.10.1.10:1080",
    }
    
    requests.get("http://example.org", proxies=proxies)
    
    0 讨论(0)
提交回复
热议问题