mercredi 7 novembre 2018

Python API Calling Random.org

So I am new to APIs but I'm trying to get more practice with them. I am getting connection okay (200) but whenever I try to print the results I receive this error:

{"jsonrpc":"2.0","error":{"code":-32700,"message":"Parse error","data":null},"id":null}

Here's my code, with the api key redacted:

    url = 'https://api.random.org/json-rpc/1/invoke'

    data = {'jsonrpc':'2.0','method':'generateIntegers','params': {'apiKey':'mykeygoeshere','n':10,'min':1,'max':10,'replacement':'true','base':10},'id':24565}

    response = requests.get(url,data)

    print(response.text) 

Any help is appreciated




Aucun commentaire:

Enregistrer un commentaire