RE: Python Libraries: No More BEEM
(Edited)
You are viewing a single comment's thread:
Or something like that. It's a matter of investing another weekend and doing the relevant tests.
This is tested:
import requests
def get_properties(node_url):
data = '{"jsonrpc":"2.0", "method":"database_api.get_dynamic_global_properties", "id":1}'
response = requests.post(node_url, data=data)
return response
Save as api.py and import your own custom calls 🙂
response
is json, I handle that like this:
import api
def get_last_irreversible_block_num(node_url):
response = api.get_properties(node_url)
num = int(response.json()["result"]['last_irreversible_block_num'])
return num
I think this is clean enough.
Use https://developers.hive.io/ api refenrence for other calls.
Please don't ask me why I called a function get_last_irreversible_block_num
🤣
I just copy pasted this from older code and thought it was a neat example for @slobberchops 😜
However: transaction signing isn't trivial, I'd recommend a library like BEEM.
Sorry for the edits.
Hope this saves someone some time.
Follow my blog 😁 for more.
0
0
0.000
0 comments