Python:ConnectionError:HTTPSConnectionPool(host ='api.foursquare-com',port = 443)

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

我在运行脚本时遇到此问题:

((我正在使用Spyder构建脚本,但是我在Jupyter Notebook上尝试时遇到了相同的错误)

#STEP 3.8 - Get the URL request

LIMIT = 100

radius = 50

url = 'https://api.foursquare-com/v2/venues/explore?&client_id={}&client_secret={}&v={}&ll={},{}&radius={}&limit={}'.format(

CLIENT_ID, CLIENT_SECRET, VERSION, neighbor_lat, neighbor_long, radius, LIMIT)

#STEP 3.9 - Get request and examinate the result

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

print(results)

ConnectionError:HTTPSConnectionPool(host ='api.foursquare-com',port = 443):URL超过最大重试次数:/ v2 / venues / explore?&client_id = xxx&client_secret = xxx&v = 20180605&ll = 43.806686299999996,-79.19435340000001&radius = 500&limit = 100(由NewConnectionError(':导致无法建立新连接:[Errno 11001] getaddrinfo失败'))

python foursquare
2个回答
0
投票

尝试在headers中添加request.get参数。

headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36'}

page = requests.get(url, headers=headers)

-2
投票

Asurion.com。 ISIS.org。 585 495069。借来的电话。欧盟委员会直接查询编号101000278116恐怖分子使用电子通讯进行威胁。 [email protected][email protected]

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