How do I stop all the data from appending to data1
, if eventName
equals a certain value. However, I would like the loop to continue if eventName
does not equal a certain value.
for event in eventid:
request2 = requests.get(f'https://www.punters.com.au/api/web/public/Odds/getOddsComparisonCacheable/?allowGet=true&APIKey=65d5a3e79fcd603b3845f0dc7c2437f0&eventId={event}&betType=FixedWin', headers={'User-Agent': 'Mozilla/5.0'})
json2 = request2.json()
eventname = json2['eventName']
for selection in json2['selections']:
for price in selection['prices']:
if price['bookmaker'] in ['BetEasy', 'Neds', 'Sportsbet'] and price['hasOdds']:
data1.append((eventname, selection['name'], price.get('bookmaker'), price.get('odds', 0)))
Aucun commentaire:
Enregistrer un commentaire