首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从Rundown API请求JSON时找不到404页

从Rundown API请求JSON时找不到404页
EN

Stack Overflow用户
提问于 2020-10-07 17:27:43
回答 1查看 91关注 0票数 0

谢谢你过来。当我为Rundown API做get请求时,我得到了"404页面未找到“消息。我已经通过了文档,我相信我正在使用适当的网址。我专门通过体育来查找事件,我使用了以下两个URL:

https://therundown-therundown-v1.p.rapidapi.com/sports/1/events?include=scores //应该返回预测分数

https://therundown-therundown-v1.p.rapidapi.com/sports/1/events //应返回这项运动即将举行的所有活动

我的API密钥正在工作,我确实从其他URL获得数据,即

https://therundown-therundown-v1.p.rapidapi.com/sports/1/events/6-1-2019 //返回当天体育赛事的数据

这是我的代码:

代码语言:javascript
复制
url = "https://therundown-therundown-v1.p.rapidapi.com/sports/1/events"

headers = {
    'x-rapidapi-host': "therundown-therundown-v1.p.rapidapi.com",
    'x-rapidapi-key': "{my_api_key}"
}

response = requests.request("GET", url, headers=headers)

print(response.text)

我想知道是否我没有得到任何数据,因为,可能,许多运动的时间表是混乱的,因为大流行.但我想我只会得到一个空的对象,而不是404。任何帮助都将不胜感激。再次感谢!

EN

回答 1

Stack Overflow用户

发布于 2020-10-08 15:04:26

问题是,他们在上面链接的文档已经过时了。显然,上面的端点不再起作用了。这里是他们的新文档的链接。现在,如果您想为某项特定的运动获得所有未来的项目,您可以这样做

代码语言:javascript
复制
url = "https://therundown-therundown-v1.p.rapidapi.com/sports/1/dates"

headers = {
    'x-rapidapi-host': "therundown-therundown-v1.p.rapidapi.com",
    'x-rapidapi-key': "a305c330demsh7dded55db30fb5cp17605fjsnda27dcdd58f3"
}

res = requests.request("GET", url, headers=headers)

dates = res.text
dates = json.loads(dates)
dates_list = dates["dates"]
for date in dates_list:
    event_url = "https://therundown-therundown-v1.p.rapidapi.com/sports/1/events/" + date
    event_res = requests.request("GET", event_url, headers=headers)
    print(event_res.text)
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64249268

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档