Football Prediction

부분 유료
분류별 boggio | 업데이트됨 16 days ago | Sports
인기

9.9 / 10

지연 시간

1,625ms

서비스 수준

100%

Health Check

N/A

모든 토론으로 돌아가기

API Key Error

Rapid account: Ajitminj
ajitminj
3 years 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!

Rapid account: Ajitminj
ajitminj Commented 3 years 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.

Rapid account: Boggio Analytics
boggio-analytics Commented 3 years ago

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

아래에 의견을 추가하고 토론에 참여하세요.

새 댓글을 게시하려면 로그인 / 가입