每当我尝试运行此代码时:
def CheckStock(url,model):
headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36'}
RawHTML = requests.get(url, headers=headers)
Page = bs4.BeautifulSoup(RawHTML.text, "lxml")
我不断得到:
requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='www.adidas.com', port=443): Read timed out. (read timeout=None)
我使用的url是:
'https://www.adidas.com/us/stan-smith-shoes/FZ3815.html?forceSelSize=FZ3815_630'
模型是:'FZ3815'
要获得正确的页面,请指定不同的
User-Agent
例如:
印刷品:
相关问题 更多 >
编程相关推荐