我正在尝试通过foursquare API调用某个位置500 m半径范围内的场馆信息。我不断收到错误:[WinError 10061]

问题描述 投票:0回答:1

这是我到目前为止的代码:

LIMIT = 50 # limit of number of venues returned by Foursquare API

radius = 500 # define radius

# create URL
url = 'https://api.foursquare.com/v2/venues/explore?&client_id={}&client_secret={}&v={}&ll={},{}&radius={}&limit={}'.format(
    CLIENT_ID, 
    CLIENT_SECRET, 
    VERSION, 
    neighborhood_latitude, 
    neighborhood_longitude, 
    radius, 
    LIMIT)

url 

results = requests.get(url).json()
results

错误:

NewConnectionError(': 无法建立新连接: [WinError 10061] 无法建立连接,因为目标机器主动拒绝'))

python json api compiler-errors foursquare
1个回答
0
投票

该版本包已弃用。我相信问题出在授权上。可能需要传入一个参数oauth_token=ACCESS_TOKEN

确保 CLIENT_ID、CLIENT_SECRET、VERSION(选择日期)正确初始化。

支持文档链接如下:https://docs.foursquare.com/developer/reference/versioning

© www.soinside.com 2019 - 2024. All rights reserved.