python-3.x - Foursquare 用户详细信息端点返回 404 错误
问题描述
我正在尝试使用 Foursquare 用户详细信息端点来检索有关不同用户的信息,但由于某种原因,我收到 404 错误。我似乎无法找到此错误的原因,因此非常感谢任何帮助。这是我的用户“67786428”的代码,您可以在 Foursquare 上找到他们的页面:https ://foursquare.com/user/67786428 。
user_id = '67786428'
url = 'https://api.foursquare.com/v2/users/{}?client_id={}&client_secret={}&v={}'.format(user_id, CLIENT_ID, CLIENT_SECRET, VERSION) # define URL
# send GET request
results = requests.get(url).json()
results
输出如下:
{'meta': {'code': 404,
'errorType': 'endpoint_error',
'errorDetail': 'Endpoint not found',
'requestId': '5e13583c02a172001bbf17c7'},
'response': {}}
- 我的 client_id 和 client_secret 正在工作,因为我正在使用场所端点获得结果。
- 我检查了我没有达到 API 调用的限制。
- 该代码以前可以工作,但我不确定 Foursquare 是否更改了他们的 API,现在必须以不同的方式构建 url,尽管根据文档,上述端点应该存在。
解决方案
您需要进行身份验证。 https://developer.foursquare.com/docs/api/configuration/authentication
试试下面的网址
https://api.foursquare.com/v2/users/{}?&oauth_token=(YOUR_TOKEN)
推荐阅读
- laravel - Laravel/Vue - JWT 令牌记住我
- mysql - 在 3 个不同表之间进行 2 次 JOIN 后查找 MAX
- php - 尽可能使用 slug 而不是 ID
- django - 如何在 django-notifications-hq 中隐藏 0 通知计数
- python - 将回归树输出转换为 pandas 表
- terraform - 如何根据条件跳过 terraform 资源中的可选参数
- visual-studio - 控制器文件夹内的新剃须刀视图
- prometheus - 使用带有身份验证的黑盒导出器
- recursion - 递归可以有无限循环吗?
- microsoft-graph-api - 通过 Microsoft Graph 共享日历