python - 抓取投注网站无法使用响应 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)
你能帮我找到解决办法吗?此外,如果您可以在该领域分享一些简单的资源以及标题可能意味着什么,我们将不胜感激。非常感谢。
解决方案
推荐阅读
- spring-boot - Spring Boot - 我在哪里可以找到这个 Bean。是豆子吗?
- python - 指示将 JSON 字符串反序列化为 Object 的类类型
- java - IntelliJ IDEA 中的 JTS 拓扑套件
- haskell - 每个 monad 都是一个应用函子——泛化到其他类别
- javascript - 如何使用 WebVR 和 A-Frame 跟踪控制器移动事件?
- javascript - Vue.js 2 替代使用键作为 JSON.stringify(obj) 在从 xhr 回调更改 obj 时重新渲染子组件
- c# - 在 SeriesCollection 中找不到名为 Series1 的图表元素
- angular-material - mat-table - 如何更新列宽
- python - Django为映射的URL返回页面未找到
- java - PDFBox - 可访问的 PDF - 如何根据可访问性指南检查 PDF 标签是否具有属性