[英]How can i get the network tab with python requests?
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0'}
proxies = {
'http': 'http://' + "185.169.198.98:3128",
'https': 'http://' + "185.169.198.98:3128",
}
r = requests.get(url,verify=True,headers=headers,proxies=proxies)
我想像在浏览器中一样获取网络数据但有请求
不确定是否可以通过requests
捕获此内容,但您可以尝试使用selenium wire
执行此操作:
from seleniumwire import webdriver # Import from seleniumwire
# Create a new instance of the Firefox driver
driver = webdriver.Firefox()
# Go to the Google home page
driver.get('https://www.google.com')
# Access and print requests via the `requests` attribute
for request in driver.requests:
if request.response:
print(
request.url,
request.response.status_code,
request.response.headers['Content-Type'])
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.