python-3.x - 无法从 python 请求中检索响应数据
问题描述
我曾尝试使用 python 请求从网站https://www.mscdirect.com/product/details/49784960获取响应数据。但我没有得到回应,我也尝试过硒。但错误仍然存在
使用 Python 请求
import requests
session=requests.session()
response=session.get('https://www.mscdirect.com/product/details/49784960')
print(response.text)
使用硒
from selenium import webdriver
options = Options()
#options.add_argument("--headless")
#options.add_argument('--disable-gpu')
driver = webdriver.Chrome(executable_path="chromedriver", chrome_options=options)
driver.delete_all_cookies()
driver.get("https://www.mscdirect.com/product/details/49784960")
print(driver.page_source)
有什么遗漏吗?对于 python 请求,我也传递了标头。