pythonjson-rpcbetfair

I get this error with betfair API : "{'code': -32602, 'message': 'DSC-0018'}" using Python


I tried this code, which is taken from the Betfair site, but it doesn't work with listMarketCatalogue, while for example with listEventTypes it works:

endpoint = "https://api.betfair.com/exchange/betting/json-rpc/v1/"
user_req='{"jsonrpc": "2.0", "method": "SportsAPING/v1.0/listMarketCatalogue", "params": {"filter":{}} , "id": 1}'
header1 = { 'X-Application' : mykey, 'X-Authentication' : SSOID, 'content-type': 'application/json'}

req=requests.post(endpoint,data=user_req.encode('utf-8'),headers=header1)

print(req.json())

and it gives me this error:

{'jsonrpc': '2.0', 'error': {'code': -32602, 'message': 'DSC-0018'}, 'id': 1}

How can I solve it?


Solution

  • A quick search shows that DSC-0018 corresponds with an error relating to a missing parameter. (Source)

    A cursory review of the relevant documentation shows you're not passing the required parameter maxResults. Add it to your JSON-RPC call's params structure with a valid value (0 < maxResults <= 10000, according to the docs at the time of this writing).