#!/usr/bin/env python import myAPILib sessionToken = myAPILib.loginAPING("yourusername","yourpassword") print (sessionToken) if sessionToken != -1: appKey = 'yourappkey' eventTypesResult = myAPILib.getEventTypes (appKey, sessionToken) horseRacingEventTypeID = myAPILib.getEventTypeIDForEventTypeName(eventTypesResult, 'Horse Racing') print ('The number for horse racing is ' + horseRacingEventTypeID) if horseRacingEventTypeID == -1: print (error) # take some evasive action, perhaps try again else: races = myAPILib.getEvents(appKey, sessionToken, horseRacingEventTypeID) if races != -1: for race in races: print (race['marketId']) race['marketStartTime'] = myAPILib.checkSummerTime(race['marketStartTime']) print (race['marketStartTime']) allRunners = race['runners'] for selection in allRunners: print (selection['runnerName'] + " " + str(selection['selectionId'])) print () print () print () ## place a bet on last horse in last race ## myStake = '2' myPrice = '1.01' betResult = myAPILib.doWager(str(race['marketId']),str(selection['selectionId']), 'LAY', myStake, myPrice, 'LAPSE' , appKey, sessionToken) if betResult['status'] == 'SUCCESS': print ('Bet ' + str(betResult['status']) + " " + selection['runnerName']) else: print ('Bet ' + str(betResult['status'])) print (betResult['instructionReports'][0]['errorCode'] + " " + selection['runnerName'] )