我正在尝试使用Foursquare场地查询场地的详细信息 API,但我收到“ invalid_auth”错误
VENUE_ID='54ea41ad498e9a11e9e13308'
VERSION = '20190823'
venueurl = 'https://api.foursquare.com/v2/venues/{}&client_id={}&client_secret={}&v={}'.format(VENUE_ID, CLIENT_ID, CLIENT_SECRET, VERSION)
venueresults = requests.get(venueurl).json()
venueresults
这是我收到的错误。
{'meta':{'code':400,'errorType':'invalid_auth','errorDetail': '缺少访问凭证。看到 https://developer.foursquare.com/docs/api/configuration/authentication 有关详细信息。”,'requestId':'5d613b698afbe000358acf53'}, '响应':{}}
我希望收到如下所示的回复(简称为 响应时间太长。
https://foursquare.com/developers/explore#req=venues%2F54ea41ad498e9a11e9e13308
{“元”:{“代码”:200“ requestId”:“ 5d613941075a420023f41750”} “ notifications”:[{“ type”:“ notificationTray”“ item”:{ “ unreadCount”:0}}]“ response”:{“ venue”:{“ id”: “ 54ea41ad498e9a11e9e13308”“名称”:“ Roselle甜品”“联系人”:{ “电话”:“ +14163688188”“ formattedPhone”:“ +1 416-368-8188”“ twitter”: “ roselle_to”}“位置”:{“ address”:“ 362 King St E”“ crossStreet”: “ Trinity St”“ lat”:43.653446723052674“ lng”:-79.3620167174383 “ labeledLatLngs”:[{“ label”:“ display”“ lat”:43.653446723052674 “ lng”:-79.3620167174383}]“ postalCode”:“ M5A 1K9”“ cc”:“ CA” “ city”:“多伦多”“ state”:“ ON”“ country”:“加拿大” “ formattedAddress”:[“ 362 King St E(Trinity St)”“多伦多ON M5A 1K9“”加拿大“]}” canonicalUrl“: “ https://foursquare.com/v/roselle-desserts/54ea41ad498e9a11e9e13308” “类别”:[{“ id”:“ 4bf58dd8d48988d16a941735”“ name”:“面包店” “ pluralName”:“面包店”“ shortName”:“面包店”“ icon”:{“前缀”: “ https://ss3.4sqi.net/img/categories_v2/food/bakery_”“后缀”:“ .png” }“ primary”:true} {“ id”:“ 4bf58dd8d48988d1d0941735”“名称”: “甜品店”“ pluralName”:“甜品店”“ shortName”:“甜品” “ icon”:{“ prefix”: “ https://ss3.4sqi.net/img/categories_v2/food/dessert_”“后缀”: “ .png”}} {“ id”:“ 4bf58dd8d48988d1c9941735”“ name”:“冰淇淋店” “ pluralName”:“冰淇淋商店”“ shortName”:“冰淇淋”“ icon”:{ “ prefix”:“ https://ss3.4sqi.net/img/categories_v2/food/icecream_” “ suffix”:“ .png”}}]“ verified”:假“ stats”:{“ tipCount”:15 “ usersCount”:674“ checkinsCount”:561“ visitsCount”:1203}“ url”: “ http://www.roselleto.com”“价格”:{“等级”:1“消息”:“便宜” “ currency”:“ $”}“ likes”:{“ count”:45“ groups”:[{“ type”: “其他”“计数”:45“项目”:[]}]“摘要”:“ 45赞”“}”赞“: 假“不喜欢”:假“确定”:假“评级”:8.8“评级颜色”: “ 73CF42”“ ratingSignals”:54“ allowMenuUrlEdit”:true“ beenHere”:{ “ count”:0“ unconfirmedCount”:0“ marked”:假 “ lastCheckinExpiredAt”:0}“ specials”:{“ count”:0“ items”:[]} “照片”:{“计数”:39“组”:[{“类型”:“签到”“名称”: “朋友的签到照片”“计数”:0“项目”:[]} {“类型”:“地点” “名称”:“场地照片”“计数”:39个“项目”:[“ 0”:{“ id”: “ 5d59a14744209c00089c596b”“ createdAt”:1566155079“ source”:{“ name”: “ Swarm for iOS”“ url”:“ https://www.swarmapp.com”
等
答案 0 :(得分:0)
我找到了答案,一个“?”在place_id后面必须输入“&”代替
'https://api.foursquare.com/v2/venues/ {}?client_id = {}&client_secret = {}&v = {}'。format(VENUE_ID,CLIENT_ID,CLIENT_SECRET,VERSION)
请参阅以下问答: