0


用Selenium给chrome添加任意请求头信息

from seleniumwire import webdriver
from config import Config

options ={'proxy':{'http':'http://127.0.0.1:9899','https':'http://127.0.0.1:9899','no_proxy':'localhost,127.0.0.1'}}definterceptor(request):
    request.headers['Authorization']='SomeAuthorizationAuthorizationValue'

driver = webdriver.Chrome(seleniumwire_options=options, executable_path=Config.CHROME_DRIVER_PATH)
driver.request_interceptor = interceptor

# All requests will now use 'some_referer' for the referer
driver.get('https://taobao.com')

我配置了代理,走burp。通过burp抓包可以看到运行结果如下,说明请求头字段更改完成。
在这里插入图片描述

标签: selenium python chrome

本文转载自: https://blog.csdn.net/qq_31310579/article/details/125546373
版权归原作者 tinker_li 所有, 如有侵权,请联系我们删除。

“用Selenium给chrome添加任意请求头信息”的评论:

还没有评论