0

I am using foursquare api to retrieve the venue for the tip with the greatest number of agree counts using requests library in jupyterLab but I am getting this error "Expecting value: line 1 column 1 (char 0)". I am new to using api calls so please help me on how to fix this error. Below is my code:

tip_id = '5ab5575d73fe2516ad8f363b' # tip id
# define URL
url = 'http://api.foursquare.com/v2/tips/{}?client_id={}&client_secret={}&v={}'.format(tip_id, CLIENT_ID, CLIENT_SECRET, VERSION)

# send GET Request and examine results
result=requests.get(url).json()
# .get(url).json()
print(result['response']['tip']['venue']['name'])
print(result['response']['tip']['venue']['location'])

error: [Error][1]

chander
  • 51
  • 1
  • 6
  • Does this answer your question? [JSONDecodeError: Expecting value: line 1 column 1 (char 0)](https://stackoverflow.com/questions/16573332/jsondecodeerror-expecting-value-line-1-column-1-char-0) – Alexander Kvist Nov 13 '20 at 21:27
  • 1
    The request has failed. Can you check what the output is, perhaps by doing `response = requests.get(url)` and then printing out `response.text`. It's most likely an HTML page or an empty string. You didn't receive a JSON response. That's why the `.json()` method failed. – m01010011 Nov 14 '20 at 01:28
  • Thanks for your response. I tried doing response = requests.get(url) earlier and it gave me 403 error (forbidden) but now this error is resolved. I just restarted my kernel and it was doing fine. – chander Nov 17 '20 at 10:59

0 Answers0