3

I'm having this issue while running the script:

(I'm using Spyder to build my script, but I'm trying at Jupyter Notebook and I'm getting the same error)

#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): Max retries exceeded with url: /v2/venues/explore?&client_id=xxx&client_secret=xxx&v=20180605&ll=43.806686299999996,-79.19435340000001&radius=500&limit=100 (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))

2
  • I think you made a typo with the url. Isn't it supposed to be https://api.foursquare.com instead of https://api.foursquare-com? Commented May 15, 2020 at 20:37
  • Yes Prateek!!! Thank you so much, it was my mistake, I couldn't recognize this. Commented May 15, 2020 at 21:10

3 Answers 3

4

Try to add headers parameters in your 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)
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks Henrique, but I got my mistake from the previous comment as I use "-" instead of "."
0

Try using the exceptions

results=" "
while results==" ":
    try:
        results = requests.get(url).json()
                 
    except:
        time.sleep(50)
        continue

Comments

0

This is common error, after doing SSL to your VPS server, it only finds the url with https://domanName.com in this case check you connection in you code File or .env file and change connections from http://domainName.com -- to -- https://domainName.com I hope this will solve your problem Thanks.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.