samuel oyekanmi
samuel oyekanmi

Reputation: 1

I am trying to call information on venues in a 500 m radius of a location via the foursquare API. I keep getting getting the error: [WinError 10061]

This is my code so far:

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

ERROR:

NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x00000175790F8308>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it'))

Upvotes: 0

Views: 50

Answers (1)

data_scientist656
data_scientist656

Reputation: 1

That version package is deprecated. I believe what went wrong is the authorization. You may need to pass in a parameter oauth_token=ACCESS_TOKEN

Make sure CLIENT_ID, CLIENT_SECRET, VERSION (select a date) is initialized correctly.

The supporting documentation is linked here: https://docs.foursquare.com/developer/reference/versioning

Upvotes: 0

Related Questions