API for horse racing too slow to bet on live racing and only one horse odds per run

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • stephanmorel
    Junior Member
    • Apr 2023
    • 3

    #1

    API for horse racing too slow to bet on live racing and only one horse odds per run

    I'm enquiring about help with the api for horseracing based on the free api key, essentially not only is it 3 seconds before I get any kind of odds or python output which is a detriment if I want to do betting with live races but also it only allows me to get one horses odds at a time regardless if I use a for loop and try and chain requests. Is this a code issue or betfair issue?
    payload = 'username=' + my_username + '&password=' + my_password
    headers = {'X-Application': my_app_key, 'Content-Type': 'application/x-www-form-urlencoded'}
    resp = requests.post('https://identitysso-cert.betfair.com/api/certlogin',data=payload,cert=('c:/Users/steph/OneDrive/Documents/2023/WORK/BETTING/client-2048.crt','c:/Users/steph/OneDrive/Documents/2023/WORK/BETTING/client-2048.pem.'),headers=headers)
    json_resp=resp.json()
    print(json_resp['loginStatus'])
    SSOID = json_resp['sessionToken']
    bet_url="https://api.betfair.com/exchange/betting/json-rpc/v1"
    event_req = '{"jsonrpc": "2.0", "method": "SportsAPING/v1.0/listEventTypes", "params": {"filter":{ "eventTypeIds":["7"],"marketCountries":["GB","AU"]}}, "id": 1}'
    headers = {'X-Application': my_app_key, 'X-Authentication': SSOID, 'content-type': 'application/json'}
    req = requests.post(bet_url, data=event_req.encode('utf-8'), headers=headers)​
  • jabe
    Senior Member
    • Dec 2014
    • 705

    #2
    The development key comes with a built-in delay. You're encouraged to get the paid-for key.

    Comment

    Working...
    X