我如何在该网站上使用请求库?,它不断给出响应403

时间:2019-08-23 01:34:56

标签: python-requests http-status-code-403

链接为:https://angel.co/medical-marijuana-dispensaries-1 每次我使用requests.get(url)时,它都会不断给我403 response,因此我无法解析

我尝试更改标头:用户代理和引荐来源网址,但没有用

import requests

page=requests.get('https://angel.co/medical-marijuana-dispensaries-1')

page

<Response [403]>

session = requests.Session()

session.headers.update({'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36'})

session.headers

{'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive'}

page=requests.get('https://angel.co/medical-marijuana-dispensaries-1')

page

<Response [403]>

page=session.get('https://angel.co/medical-marijuana-dispensaries-1')

page

<Response [403]>

0 个答案:

没有答案