Hello,
I am trying to get access to TNG data using the API key in my user profile but it doesn't work. After running a few tests, it seems like the API request is not accepted. Here is the code I used in VS code to check if the API key works:
import requests api_key = "KEY_HERE" url = "https://www.tng-project.org/api/" headers = { "Authorization": f"Token {api_key}" } response = requests.get(url, headers=headers) print(f"Status Code: {response.status_code}") print("Response:", response.json())
And this is the output:
Status Code: 403 Response: {'detail': 'Failed session auth (and no API-Key sent).'}
How can I overcome this problem? Thank you so much for helping me out!
The headers needs to have the right structure:
headers
headers = {"api-key":api_key}
Thank you!
Hello,
I am trying to get access to TNG data using the API key in my user profile but it doesn't work. After running a few tests, it seems like the API request is not accepted. Here is the code I used in VS code to check if the API key works:
And this is the output:
How can I overcome this problem? Thank you so much for helping me out!
The
headers
needs to have the right structure:Thank you!