首页 > 解决方案 > 抓取投注网站无法使用响应 403 - 禁止

问题描述

我想刮 Betway.com。但是,当我尝试使用请求库请求页面时,我收到 403 Forbidden 响应。

我偶然发现了以下线程:Using headers with the Python requests library's get method 它说我可以使用 headers 解决问题。我试过了,还是不行。这是我的代码:

import requests


url = "https://betway.com/fr/sports/cat/ufc---martial-arts"

headers = {'authority': "app.launchdarkly.com",
'method': "OPTIONS",
'path': "/sdk/goals/5ce3ca97d7d666081b7523a7",
'scheme': "https",
'accept': "*/*",
'accept-encoding': "gzip, deflate, br",
'accept-language': "fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7",
'access-control-request-headers': "x-launchdarkly-user-agent",
'access-control-request-method': "GET",
'origin': "https://betway.com",
'referer': "https://betway.com/",
'sec-fetch-dest': "empty",
'sec-fetch-mode': "cors",
'sec-fetch-site': "cross-site"}

result = requests.get(url, headers=headers)

你能帮我找到解决办法吗?此外,如果您可以在该领域分享一些简单的资源以及标题可能意味着什么,我们将不胜感激。非常感谢。

标签: pythonweb-scrapingpython-requestsgetrequest

解决方案


推荐阅读