Python - Foursquare API “Missing Auth Credentials'” userless search?
up vote
0
down vote
favorite
I am trying to use the foursquare API for the first time and have not been able to get a 200 status code no matter what I tried. Using directly the code foursquare provides in its docs, I attempt to do a userless request, replacing my client ID and secret where necessary.
def places_search(term,street, zipcode):
params = dict(
client_id='MY_CLIENT_ID',
client_secret='MY_CLIENT_SECRET',
v='20181122',
near=street + 'New York, NY ' + zipcode,
query=term,
limit=1
)
url = "https://api.foursquare.com/v2/venues/explore"
resp = requests.get(url=url, params=params)
#grabbing the JSON result
data = json.loads(resp.text)
return data
print(places_search("starbucks","3rd avenue","10009"))
I get the following error code:
{'meta': {'code': 400, 'errorType': 'invalid_auth', 'errorDetail': 'Missing access credentials. See https://developer.foursquare.com/docs/api/configuration/authentication for details.', 'requestId': '5bf6cbb26a607137bc33b7f2'}, 'response': {}}
I find it odd given my request is userless and matches exactly the way they outline it in the docs... Would you have an idea what I am doing wrong?
Thanks,
python authentication foursquare
add a comment |
up vote
0
down vote
favorite
I am trying to use the foursquare API for the first time and have not been able to get a 200 status code no matter what I tried. Using directly the code foursquare provides in its docs, I attempt to do a userless request, replacing my client ID and secret where necessary.
def places_search(term,street, zipcode):
params = dict(
client_id='MY_CLIENT_ID',
client_secret='MY_CLIENT_SECRET',
v='20181122',
near=street + 'New York, NY ' + zipcode,
query=term,
limit=1
)
url = "https://api.foursquare.com/v2/venues/explore"
resp = requests.get(url=url, params=params)
#grabbing the JSON result
data = json.loads(resp.text)
return data
print(places_search("starbucks","3rd avenue","10009"))
I get the following error code:
{'meta': {'code': 400, 'errorType': 'invalid_auth', 'errorDetail': 'Missing access credentials. See https://developer.foursquare.com/docs/api/configuration/authentication for details.', 'requestId': '5bf6cbb26a607137bc33b7f2'}, 'response': {}}
I find it odd given my request is userless and matches exactly the way they outline it in the docs... Would you have an idea what I am doing wrong?
Thanks,
python authentication foursquare
even using the below that comes right from foursquare and plugging in today's date as well as the client_id and client_secret, i get the same errorhttps://api.foursquare.com/v2/venues/search?ll=40.7,-74&client_id=CLIENT_ID&client_secret=CLIENT_SECRET&v=YYYYMMDD
– user1867507
Nov 22 at 18:34
I implemented your code and it works fine for me. Maybe your client_id/client_secret is wrong.
– Kosuke Ogawa
Nov 26 at 1:02
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am trying to use the foursquare API for the first time and have not been able to get a 200 status code no matter what I tried. Using directly the code foursquare provides in its docs, I attempt to do a userless request, replacing my client ID and secret where necessary.
def places_search(term,street, zipcode):
params = dict(
client_id='MY_CLIENT_ID',
client_secret='MY_CLIENT_SECRET',
v='20181122',
near=street + 'New York, NY ' + zipcode,
query=term,
limit=1
)
url = "https://api.foursquare.com/v2/venues/explore"
resp = requests.get(url=url, params=params)
#grabbing the JSON result
data = json.loads(resp.text)
return data
print(places_search("starbucks","3rd avenue","10009"))
I get the following error code:
{'meta': {'code': 400, 'errorType': 'invalid_auth', 'errorDetail': 'Missing access credentials. See https://developer.foursquare.com/docs/api/configuration/authentication for details.', 'requestId': '5bf6cbb26a607137bc33b7f2'}, 'response': {}}
I find it odd given my request is userless and matches exactly the way they outline it in the docs... Would you have an idea what I am doing wrong?
Thanks,
python authentication foursquare
I am trying to use the foursquare API for the first time and have not been able to get a 200 status code no matter what I tried. Using directly the code foursquare provides in its docs, I attempt to do a userless request, replacing my client ID and secret where necessary.
def places_search(term,street, zipcode):
params = dict(
client_id='MY_CLIENT_ID',
client_secret='MY_CLIENT_SECRET',
v='20181122',
near=street + 'New York, NY ' + zipcode,
query=term,
limit=1
)
url = "https://api.foursquare.com/v2/venues/explore"
resp = requests.get(url=url, params=params)
#grabbing the JSON result
data = json.loads(resp.text)
return data
print(places_search("starbucks","3rd avenue","10009"))
I get the following error code:
{'meta': {'code': 400, 'errorType': 'invalid_auth', 'errorDetail': 'Missing access credentials. See https://developer.foursquare.com/docs/api/configuration/authentication for details.', 'requestId': '5bf6cbb26a607137bc33b7f2'}, 'response': {}}
I find it odd given my request is userless and matches exactly the way they outline it in the docs... Would you have an idea what I am doing wrong?
Thanks,
python authentication foursquare
python authentication foursquare
asked Nov 22 at 15:38
user1867507
205
205
even using the below that comes right from foursquare and plugging in today's date as well as the client_id and client_secret, i get the same errorhttps://api.foursquare.com/v2/venues/search?ll=40.7,-74&client_id=CLIENT_ID&client_secret=CLIENT_SECRET&v=YYYYMMDD
– user1867507
Nov 22 at 18:34
I implemented your code and it works fine for me. Maybe your client_id/client_secret is wrong.
– Kosuke Ogawa
Nov 26 at 1:02
add a comment |
even using the below that comes right from foursquare and plugging in today's date as well as the client_id and client_secret, i get the same errorhttps://api.foursquare.com/v2/venues/search?ll=40.7,-74&client_id=CLIENT_ID&client_secret=CLIENT_SECRET&v=YYYYMMDD
– user1867507
Nov 22 at 18:34
I implemented your code and it works fine for me. Maybe your client_id/client_secret is wrong.
– Kosuke Ogawa
Nov 26 at 1:02
even using the below that comes right from foursquare and plugging in today's date as well as the client_id and client_secret, i get the same error
https://api.foursquare.com/v2/venues/search?ll=40.7,-74&client_id=CLIENT_ID&client_secret=CLIENT_SECRET&v=YYYYMMDD
– user1867507
Nov 22 at 18:34
even using the below that comes right from foursquare and plugging in today's date as well as the client_id and client_secret, i get the same error
https://api.foursquare.com/v2/venues/search?ll=40.7,-74&client_id=CLIENT_ID&client_secret=CLIENT_SECRET&v=YYYYMMDD
– user1867507
Nov 22 at 18:34
I implemented your code and it works fine for me. Maybe your client_id/client_secret is wrong.
– Kosuke Ogawa
Nov 26 at 1:02
I implemented your code and it works fine for me. Maybe your client_id/client_secret is wrong.
– Kosuke Ogawa
Nov 26 at 1:02
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
As per the documentation:
To make a userless request, specify your consumer key’s Client ID and
Secret instead of an auth token in the request URL.
Like this:
https://api.foursquare.com/v2/venues/search?ll=40.7,-74&client_id=CLIENT_ID&client_secret=CLIENT_SECRET&v=YYYYMMDD
Since you are passing the credentials as the request parameters, the server cannot authenticate you.
I am still getting the same error withhttps://api.foursquare.com/v2/venues/search?near=2nd+avenue+12th+streetNew+York%2C+NY+10009&client_id=clientid&client_secret=clientsecret&v=20181122
– user1867507
Nov 22 at 16:46
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
As per the documentation:
To make a userless request, specify your consumer key’s Client ID and
Secret instead of an auth token in the request URL.
Like this:
https://api.foursquare.com/v2/venues/search?ll=40.7,-74&client_id=CLIENT_ID&client_secret=CLIENT_SECRET&v=YYYYMMDD
Since you are passing the credentials as the request parameters, the server cannot authenticate you.
I am still getting the same error withhttps://api.foursquare.com/v2/venues/search?near=2nd+avenue+12th+streetNew+York%2C+NY+10009&client_id=clientid&client_secret=clientsecret&v=20181122
– user1867507
Nov 22 at 16:46
add a comment |
up vote
0
down vote
As per the documentation:
To make a userless request, specify your consumer key’s Client ID and
Secret instead of an auth token in the request URL.
Like this:
https://api.foursquare.com/v2/venues/search?ll=40.7,-74&client_id=CLIENT_ID&client_secret=CLIENT_SECRET&v=YYYYMMDD
Since you are passing the credentials as the request parameters, the server cannot authenticate you.
I am still getting the same error withhttps://api.foursquare.com/v2/venues/search?near=2nd+avenue+12th+streetNew+York%2C+NY+10009&client_id=clientid&client_secret=clientsecret&v=20181122
– user1867507
Nov 22 at 16:46
add a comment |
up vote
0
down vote
up vote
0
down vote
As per the documentation:
To make a userless request, specify your consumer key’s Client ID and
Secret instead of an auth token in the request URL.
Like this:
https://api.foursquare.com/v2/venues/search?ll=40.7,-74&client_id=CLIENT_ID&client_secret=CLIENT_SECRET&v=YYYYMMDD
Since you are passing the credentials as the request parameters, the server cannot authenticate you.
As per the documentation:
To make a userless request, specify your consumer key’s Client ID and
Secret instead of an auth token in the request URL.
Like this:
https://api.foursquare.com/v2/venues/search?ll=40.7,-74&client_id=CLIENT_ID&client_secret=CLIENT_SECRET&v=YYYYMMDD
Since you are passing the credentials as the request parameters, the server cannot authenticate you.
answered Nov 22 at 16:12
drec4s
1,5472621
1,5472621
I am still getting the same error withhttps://api.foursquare.com/v2/venues/search?near=2nd+avenue+12th+streetNew+York%2C+NY+10009&client_id=clientid&client_secret=clientsecret&v=20181122
– user1867507
Nov 22 at 16:46
add a comment |
I am still getting the same error withhttps://api.foursquare.com/v2/venues/search?near=2nd+avenue+12th+streetNew+York%2C+NY+10009&client_id=clientid&client_secret=clientsecret&v=20181122
– user1867507
Nov 22 at 16:46
I am still getting the same error with
https://api.foursquare.com/v2/venues/search?near=2nd+avenue+12th+streetNew+York%2C+NY+10009&client_id=clientid&client_secret=clientsecret&v=20181122
– user1867507
Nov 22 at 16:46
I am still getting the same error with
https://api.foursquare.com/v2/venues/search?near=2nd+avenue+12th+streetNew+York%2C+NY+10009&client_id=clientid&client_secret=clientsecret&v=20181122
– user1867507
Nov 22 at 16:46
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53434276%2fpython-foursquare-api-missing-auth-credentials-userless-search%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
even using the below that comes right from foursquare and plugging in today's date as well as the client_id and client_secret, i get the same error
https://api.foursquare.com/v2/venues/search?ll=40.7,-74&client_id=CLIENT_ID&client_secret=CLIENT_SECRET&v=YYYYMMDD
– user1867507
Nov 22 at 18:34
I implemented your code and it works fine for me. Maybe your client_id/client_secret is wrong.
– Kosuke Ogawa
Nov 26 at 1:02