0

After reading the documentation about EOS APIs, I tried to get information about an account on the blockchain by following examples and docs. However it's not working and I really don't understand why. This is my Python code:

import requests # Requests: HTTP for Humans

url = "https://api.eosn.io/v1/chain/get_account"
data = {"account": "yupcreators1"}
r = requests.post(url, data)
print(r.status_code)
print(r.text)

This is the response error I get:

500
{"code":500,"message":"Internal Service Error","error":{"code":4,"name":"parse_error_exception","what":"Parse Error","details":[{"message":"Unexpected char '97' in \"account\"","file":"json.cpp","line_number":436,"method":"variant_from_stream"},{"message":"","file":"json.cpp","line_number":459,"method":"from_string"}]}}

Thanks in advance for any help.

2

You need 'account_name' instead of 'account', and json needs to be dumped.

import requests, json

url = "https://api.eosn.io/v1/chain/get_account"
data = {"account_name": "yupcreators1"}
r = requests.post(url, json.dumps(data))
print(r.status_code)
print(r.text)
1
  • The account instead of account_name was my mistake when copying the code here, I didn't know I had to dump the data because with the other methods it worked just fine. It works now, thanks a lot. Mar 1 at 14:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.