Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Info

 Note:  If the command line arguments for application key and session token are not provided then the script will prompt for application key and session token

Code Snippets

Calling API-NG with JSON-RPC protocol

...

Code Block
languagepython
URL = url = "https://api.betfair.com/exchange/betting/json-rpc/v1"
jsonrpc_req = '{"jsonrpc": "2.0", "method": "SportsAPING/v1.0/listEventTypes", "params": {"filter":{ }}, "id": 1}'
headers = {'X-Application': appKey, 'X-Authentication': sessionToken, 'content-type': 'application/json'}

def callAping(jsonrpc_req):
    try:
        req = urllib2.Request(url, jsonrpc_req, headers)
        response = urllib2.urlopen(req)
        jsonResponse = response.read()
        return jsonResponse
    except urllib2.URLError:
        print 'Oops no service available at ' + str(url)
        exit()
    except urllib2.HTTPError:
        print 'Oops not a valid operation from the service ' + str(url)
        exit()

...

Calling API-NG with Rescript protocol

...