【发布时间】:2021-03-20 18:46:40
【问题描述】:
我尝试了以下方法:
- 在请求中获取整个 url:
response = requests.get('https://www1.nseindia.com/products/dynaContent/common/productsSymbolMapping.jsp?symbol=SBIN&segmentLink=3&symbolCount=2&series=EQ&dateRange=+&fromDate=01-01-2020&toDate=31-12-2020&dataType=PRICEVOLUMEDELIVERABLE')
- 获取基础网页并添加参数:
response = requests.get('https://www1.nseindia.com/products/dynaContent/common/productsSymbolMapping.jsp', params = {'symbol':'SBIN','segmentLink':'3','symbolCount':'2','series':'EQ','dateRange':' ','fromDate':'01-01-2020','toDate':'31-12-2020','dataType':'PRICEVOLUMEDELIVERABLE'})
- 使用了 urllib:
f = urllib.request.urlopen('https://www1.nseindia.com/products/dynaContent/common/productsSymbolMapping.jsp?symbol=SBIN&segmentLink=3&symbolCount=2&series=EQ&dateRange=+&fromDate=01-01-2020&toDate=31-12-2020&dataType=PRICEVOLUMEDELIVERABLE')
以上方法均无效。 他们只是无限期地加载。
提前致谢。
【问题讨论】:
-
当我打开链接时,它说 GET 方法未授权
-
设置常用浏览器的用户代理头!
-
检查你的网址...似乎你有 www1 而不是 www
标签: python python-3.x python-requests urllib