[英]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.