add ssl proxy support to browser and browser2 and add the option _proxy_ssl

This commit is contained in:
Johann Broudin 2014-03-13 19:12:33 +01:00 committed by Romain Bignon
commit 0f1726d01c
3 changed files with 26 additions and 14 deletions

View file

@ -223,15 +223,8 @@ class StandardBrowser(mechanize.Browser):
# Use a proxy
self.proxy = proxy
if proxy:
proto = 'http'
if '://' in proxy:
v = urlsplit(proxy)
proto = v.scheme
domain = v.netloc
else:
domain = proxy
self.set_proxies({proto: domain})
if proxy is not None:
self.set_proxies(proxy)
# Share cookies with firefox
if firefox_cookies and HAVE_COOKIES:
@ -481,7 +474,7 @@ class BaseBrowser(StandardBrowser):
does not keep history
:type history: object
:param proxy: proxy URL to use
:type proxy: str
:type proxy: dictionnary
:param logger: logger to use for logging
:type logger: :class:`logging.Logger`
:param factory: mechanize factory. None to use Mechanize's default