2015-04-07 75 views
0

我閱讀文檔,Google搜索,我能找到的唯一的事情就是:設置機械化HTTPS代理(python) - 可能嗎?

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

這似乎表明這是不可能的。我寧願不去挖掘另一個圖書館,有人知道這是可能的嗎?

+0

怎麼樣[this](https://gist.github.com/emergent/3983870)。?這是紅寶石,但也許,你可以適應解決方案。 –

+0

我認爲這是一般的http代理?我正在嘗試https – Solaxun

回答

0

你可以像這樣在機械化設置HTTPS代理。

import mechanize 
url = 'https://www.hostname.com/' 
br = mechanize.Browser() 
br.set_proxies({"http":"username:[email protected]:port", 
       "https":"username:[email protected]:port"}) 
br.set_handled_schemes(['http', 'https']) 
br.open(url)