Reputation: 27
I'm having trouble finding the right path when requesting data from this API (Food Standards Agency), specifically Ratings. I keep getting this error: "The API 'ratings' doesn't exist"
I'm new to this so would appreciate if someone could point me in the right direction?
This is a link to the documentation: https://api.ratings.food.gov.uk/Help/Api/GET-Ratings
This is my code:
import requests
import json
import pandas as pd
url = "http://api.ratings.food.gov.uk/ratings"
#params = {}
headers = {"x-api-version": 2,
"accept": "application/json",
"content-type": "application/json"
}
response = requests.get(url)
data = response.json()
print(data)
Upvotes: 0
Views: 133
Reputation: 369
You are not using your headers
It should be within your request: response = requests.get(url, headers=headers)
Upvotes: 1