首页 > 解决方案 > 如何在 python selenium firefox webdriver 中设置标题

问题描述

我正在通过一个名为 ProxyMesh 的站点进行 IP 旁路编程。

下面是我创建的代码。

def ip_bypass_proxymesh():
    profile = webdriver.FirefoxProfile()
    profile.set_preference("browser.privatebrowsing.autostart", True)
    profile.set_preference("network.proxy.type", 1)
    profile.set_preference("network.proxy.http", '1xx.2xx.1xx.30')
    profile.set_preference("network.proxy.http_port", 312xx)
    profile.set_preference("network.proxy.ssl", '45.32.2xx.x6')
    profile.set_preference("network.proxy.ssl_port", 31xxx)
    driver = webdriver.Firefox(firefox_profile=profile, executable_path='D:\webdrivers/geckodriver')
    return driver

我想添加一个指定国家的标题,

------>>> header = {'X-ProxyMesh-Country: US'}

但我不知道。(我搜索了这个,但由于我是初学者,我不明白。)

如果你让我知道,我将不胜感激。

https://docs.proxymesh.com/article/7-request-response-headers#x-proxymesh-country

非常感谢。

标签: pythonpython-3.xselenium-webdriverheaderselenium-firefoxdriver

解决方案


推荐阅读