Мне не удается добавить название встречи для каждой лошади в скачке. Я думаю, что рассматриваю список как словарь. Как узнать разницу между списком и словарем при чтении JSON и как мне изменить свой код, чтобы он мог добавлять список?
Мой код:
import requests
import json
import pandas as pd
from itertools import chain
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
links = []
request1 = requests.get('https://api.beta.tab.com.au/v1/recommendation-service/featured-events?jurisdiction=NSW')
json1 = request1.json()
for n in json1['nextToGoRaces']:
links.append(n['_links']['self'])
tabntg2 = []
for l in links:
request2 = requests.get(l)
json2 = request2.json()
for m in json2['meeting']:
for r in json2['runners']:
tabntg2.append((m['meetingName'], r['runnerName'], r['parimutuel']['returnWin']))
JSON:
"raceNumber":7,
"raceName":"JOCKEY CELEBRATION DAY SPRINT",
"raceDistance":1000,
"trackDirection":"anticlockwise",
"meeting":{
"meetingName":"BELMONT",
"venueMnemonic":"BEL",
"meetingDate":"2020-08-01",
"location":"WA",
"raceType":"R",
"sellCode":{}
},
"skyRacing":{},
"hasParimutuel":true,
"hasFixedOdds":true,
"broadcastChannel":null,
"broadcastChannels":[],
"hasForm":true,
"hasEarlySpeedRatings":true,
"allIn":false,
"cashOutEligibility":"Disabled",
"allowBundle":true,
"willHaveFixedOdds":true,
"fixedOddsOnlineBetting":true,
"raceStartTime":"2020-08-01T08:00:00.000Z",
"raceClassConditions":"MIN-84",
"apprenticesCanClaim":false,
"prizeMoney":"$100000.00",
"raceStatus":"Normal",
"substitute":"NR",
"results":[],
"pools":[],
"allowMulti":true,
"allowParimutuelPlace":true,
"parimutuelPlaceStatus":"Open",
"allowFixedOddsPlace":true,
"numberOfPlaces":3,
"numberOfFixedOddsPlaces":3,
"runners":[
{
"runnerName":"FLOW",