Horse Racing

FREEMIUM
Durch API | Aktualisiert 9 घंटे पहले | Sports
Popularität

9.8 / 10

Latenz

600ms

Service Level

100%

Health Check

N/A

Zurück zu allen Diskussionen

Struggling to parse JSON from 'racedetails'

Rapid account: Gramb 0 Id
Gramb0id
1年前

Hi, I’m struggling with parsing (or even receiving) JSON from racedetails. The python requests & http snippets just return the horses but not the odds. I get the horse data but the odds show as an empty list []. Any ideas? Many thanks!

Rapid account: Gramb 0 Id
Gramb0id Commented 1年前

Ah! There is usually a simple explanation.
Thank you!

Rapid account: Ortegalex
ortegalex Commented 1年前

Hi Gramb0id,
you haven’t got odds because the race has finished. Odds are only available on non finished races.
Once race finished you should get sp (starting prices).

Thanks.
Best regards,
Alex

Rapid account: Gramb 0 Id
Gramb0id Commented 1年前

Hi, thanks for your prompt response.

Also I am rusty at python, requests etc. But I’ve tried dumping into file etc and I always get the same thing. An empty ‘odds’ list for each horse.
I also tried the python http snippet, and various different variations of the requests get method.

This is my code;

import requests

#response = {}

url = “https://horse-racing.p.rapidapi.com/race/229663

headers = {
“content-type”: “application/json”,
“X-RapidAPI-Key”: “???”,
“X-RapidAPI-Host”: “horse-racing.p.rapidapi.com
}

response = requests.get(url, headers=headers, stream=True)
race_details = response.json()

race_details

And this is what I get at the end of each horse in the response;

‘dam’: ‘TOQUE ROUGE(FR)’,
‘OR’: ‘’,
‘sp’: ‘67’,
‘odds’: []},

 Unfortunately an empty list. 
 
 Your help is greatly appreciated!
Rapid account: Ortegalex
ortegalex Commented 1年前

Hi Gramb0id,
It’s weird, we don’t have any issue about odds.
Can you check it again.

Thanks
Alex

Nehmen Sie an der Diskussion teil - fügen Sie unten einen Kommentar hinzu:

Anmelden / Registrieren, um neue Kommentare zu veröffentlichen