我第一次尝试使用foursquare API,但无论我怎么尝试都无法获得200状态码。我直接使用foursquare在其文档中提供的代码,尝试执行无用户请求,在必要时替换我的客户机ID和secret。你知道吗
def places_search(term,street, zipcode):
params = dict(
client_id='MY_CLIENT_ID',
client_secret='MY_CLIENT_SECRET',
v='20181122',
near=street + 'New York, NY ' + zipcode,
query=term,
limit=1
)
url = "https://api.foursquare.com/v2/venues/explore"
resp = requests.get(url=url, params=params)
#grabbing the JSON result
data = json.loads(resp.text)
return data
print(places_search("starbucks","3rd avenue","10009"))
我得到以下错误代码:
{'meta': {'code': 400, 'errorType': 'invalid_auth', 'errorDetail': 'Missing access credentials. See https://developer.foursquare.com/docs/api/configuration/authentication for details.', 'requestId': '5bf6cbb26a607137bc33b7f2'}, 'response': {}}
我觉得这很奇怪,因为我的请求是无用户的,而且完全符合他们在文档中列出的方式。。。你知道我做错了什么吗?你知道吗
谢谢你
根据documentation:
像这样:
由于您将凭据作为请求参数传递,因此服务器无法对您进行身份验证。你知道吗
相关问题 更多 >
编程相关推荐