Как мне создать al oop, который перебирает «цены» для "productType":"WIN_ODDS_BSP"
.
Вот пример JSON:
"runners":[{"selectionId":"24369070",
"runnerName":"Bloomin Crafty",
"barrierNo":3,
"saddleClothNo":1,
"placedResult":2,
"startingPosition":1,
"trainerName":"Kathryn Durden",
"jockeyName":"Jarrod Fry",
"weight":58.0,
"silkColor":"Hot Pink Royal Blue Horseshoe Hot Pink Royal Blue \u0026 White Checked Sleeves \u0026 Cap",
"colorURL":"c20200713MURT/1364572.png",
"bestTote":10.4,
"markets":[{"productType":"WIN_ODDS_BSP",
"price":10.09,
"reductionFactor":8.33,
{"productType":"PLACE_ODDS_BSP",
"price":2.92,
"reductionFactor":13.85
}],
"bestNZTote":0}]
Вот мой код, который работает до последней строки:
for marketid in marketids:
request2 = requests.get(f'https://betfair-data-supplier-prod.herokuapp.com/api/race_results/?market_id=1.{marketid}&nz_tote_event_id=',
headers={'User-Agent': 'Mozilla/5.0'})
json2 = request2.json()
for runner in json2['runners']:
for market in runner['markets']:
if market['productType'] in ['WIN_ODDS_BSP']:
for p in market['price']: