Football Prediction

Door boggio | Bijgewerkt 3 months ago | Sports

9.8 / 10





Terug naar alle discussies

API Key Error

3 months ago

Hi There!

I tried to run the tutorial “Get sorted predictions for tomorrow using Python” with Python on Jupyter notebook. However the code throws an error with API key.

How do i execute the following step in Jupyter notebook:?!

setx RAPIDAPI_KEY “my-secret-api-key” on a windows machine

I am unable to attach the screenshot. he image attachment link doesnt seem to be working.

Thanks looking forward to the response!

boggio-analytics commented 3 months ago


The example is based on best practices for security, the RAPIDAPI_KEY is to be treated as a secret.
However for testing purposes it is easier to just specify the key directly.

In the tutorial simply copy paste your api key in the headers dict, as a value for “X-RapidAPI-Key”

    headers = {
        'User-Agent': 'python_requests',
        "X-RapidAPI-Key": "YOUR API KEY" <- here

For information about how to get an api_key check

ajitminj commented 3 months ago

Thank you for the response!

I replaced the key from the headers dict and the output received is as given below:

Bad response from server, status-code: 200
b’{“data”: [], “errors”: {“other”: “No data available. (requested: {‘federation’: ‘UEFA’, ‘iso_date’: ‘2021-09-07’, ‘market’: ‘classic’})”}}’

Why is it saying its an invalid request? Can i share the API key am using here??

Thank You.

Doe mee aan de discussie - voeg hieronder een opmerking toe

Log in / Schrij u in om nieuwe opmerkingen te plaatsen
Beoordeling: 3.5 - Stemmen: 6