开发者

Proxy setting for zope.testbrowser

开发者 https://www.devze.com 2023-03-18 20:27 出处:网络
In mechanize we can set proxy like this: br = mechanize.Browser() br.set_proxies({\"http\": \"joe:password@myproxy.example.com:3开发者_StackOverflow社区128\",

In mechanize we can set proxy like this:

br = mechanize.Browser()
br.set_proxies({"http": "joe:password@myproxy.example.com:3开发者_StackOverflow社区128",
"ftp": "proxy.example.com",})

How do we do the same for zope.testbrowser?

Many thanks!


zope.testbrowser is a wrapper around mechanize, and you can reach the wrapped mechanize browser via the mech_browser attribute:

 browser.mech_browser.set_proxies(dict(
     http="joe:password@myproxy.example.com:3128",
     ftp="proxy.example.com",
 ))

Not tested, but the above should work.

0

精彩评论

暂无评论...
验证码 换一张
取 消