Horse Racing

ÜCRETSİZ PREMIUM
Taraf API | Güncelleyen 8 дней назад | Sports
Popülerlik

9.8 / 10

Gecikme

555ms

Hizmet Düzeyi

100%

Health Check

N/A

Tüm Tartışmalara Dön

Struggling to parse JSON from 'racedetails'

Rapid account: Gramb 0 Id
Gramb0id
год назад

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 год назад

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

Rapid account: Ortegalex
ortegalex Commented год назад

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 год назад

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 год назад

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

Thanks
Alex

Aşağıya yorum ekleyerek tartışmaya katılın:

Yeni yorumlar göndermek için giriş yapın / kaydolun