密钥错误:'组' (Foursquare API探索场地)
“群”
KeyError:我打电话时 结果= requests.get(url).json()['wendment'] ['组'] [0] ['items']
我的foursquare api调用尚未耗尽,但每次都会出现此错误。我什至尝试使用新的客户端ID和客户端秘密运行它,但问题仍然存在。 我很想对这个问题有一些有力的解决方案,以便我可以进一步进步。
KeyError : 'groups'
When I call
results = requests.get(url).json()['response']['groups'][0]['items']
My foursquare API calls are not exhausted yet and still this error shows up every time. I even tried running it by using new client ID and client secret but the problem still persists.
I would love to have some strong solution to this issue so that I can progress further with my project.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来您正在错误地解析JSON的最新版本API。 “响应”,“组”和“项目”未返回。
您可以在此处的“地点搜索响应”上找到所有可用字段 - > https://develoveler.foursquare.com/reference comleference comleference comleference/reference/response-fields
我有能力要成功地从带有以下代码的请求中返回第一个项目。只需用您的API键替换API键,它应该可以使用。
It looks like you are parsing the json incorrectly for the latest version of the Places API. 'response', 'groups' and 'items' are not returned.
You can find all the available fields on the Places search response here --> https://developer.foursquare.com/reference/response-fields
I was able to successfully return the first item from a request with the below code. Just replace the API key with yours and it should work.