I'm new to using APIs in python and trying to access an API at the moment but keep getting an error code that based on the API documentation means I do not have access. I do have an account with an API key, so I assume there is an issue going on with passing the given key. According to the Documentation:
With shell, you can just pass the correct header with each request curl "api_endpoint_here" -H "Authorization: YOUR_API_KEY"
My code reads as follows:
api_url = 'https://api.balldontlie.io/v1/teams'
api_key = 'MyKey'
headers = {
'Authorization' : 'MyKey'
}
response = requests.get(api_url)
print("hello")
if response.status_code == 200:
data = response.json
print(data)
else:
print(response.status_code)
What am I doing wrong here?