Football Prediction

免费增值
通过 boggio | 已更新 8 дней назад | Sports
人气

9.8 / 10

延迟

1,446ms

服务等级

100%

Health Check

N/A

返回所有讨论

API Key Error

Rapid account: Ajitminj
ajitminj
3 года назад

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!

Rapid account: Ajitminj
ajitminj Commented 3 года назад

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.

Rapid account: Boggio Analytics
boggio-analytics Commented 3 года назад

Hi,

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 https://docs.rapidapi.com/docs/consumer-quick-start-guide

加入讨论 - 在下面添加评论:

登录/注册以发布新的评论