【发布时间】:2019-04-12 04:43:58
【问题描述】:
我正在使用 Python 上的 Selenium 为 Firefox 驱动程序设置代理。
我按照以下说明设置代理:https://github.com/luminati-io/api/blob/master/python/3.x/simple.py
username = 'lum-customer-CUSTOMER-zone-YOURZONE'
password = 'YOURPASS'
port = 22225
session_id = random.random()
super_proxy_url = ('http://%s-session-%s:%s@zproxy.luminati.io:%d' %
(username, session_id, password, port))
proxy = Proxy({
'proxyType': ProxyType.MANUAL,
'httpProxy': super_proxy_url,
'ftpProxy': super_proxy_url,
'sslProxy': super_proxy_url,
'noProxy': '' # set this value as desired
})
print(proxy)
driver = webdriver.Firefox(executable_path = "./bin/geckodriver", proxy=proxy)
driver.get('https://www.google.com')
但代理似乎不起作用。即使我为代理设置了错误的使用/密码和主机 URL,我也始终可以连接到该站点。
我错过了什么吗?
任何想法都值得赞赏。谢谢!
【问题讨论】:
标签: python python-3.x selenium proxy