create account

RE: A python script that streams the new blocks in JSON format - and how to find full documentation for the python steem library by dragosroua

View this thread on: hive.blogpeakd.comecency.com

Viewing a response to: @l0k1/a-python-script-that-streams-the-new-blocks-in-json-format-and-how-to-find-full-documentation-for-the-python-steem-library

· @dragosroua ·
Nifty! :) I just saw the `We can't code here` thing and I had to agree completely. :)
👍  
properties (23)
authordragosroua
permlinkre-l0k1-a-python-script-that-streams-the-new-blocks-in-json-format-and-how-to-find-full-documentation-for-the-python-steem-library-20170308t080638416z
categorysteem
json_metadata{"tags":["steem"],"app":"steemit/0.1"}
created2017-03-08 08:06:39
last_update2017-03-08 08:06:39
depth1
children7
last_payout2017-04-08 09:28:30
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length85
author_reputation372,798,229,806,288
root_title"A python script that streams the new blocks in JSON format - and how to find full documentation for the python steem library"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id2,670,951
net_rshares193,414,002,934
author_curate_reward""
vote details (1)
@l0k1 ·
I will be publishing soon the info on how to bypass piston because it is missing some vital bit of code that stops it running (and you can't set default_author with it). I dug back into my old posts and found that I had already partly worked out this problem and I have gone further now, setting a specified RPC node to connect to. The code looks  like this:

     st = Steem ( wif = 'aoeuaoeuaoeuaoeuaoeuaoeuaoeuaoeuaoeuaoeuaoeuaoeuaoe', node = 'wss://node.steem.ws')

This sets the account that it requires to have at least one set, that lets you do broadcasts (so you could use a posting key here rather than master or active, possibly even memo only for read only functions). I think it needs this for the `custom_json` function in `Steem`, I am writing a script to grab the data of the active witnesses so I can process the data in the output.
properties (22)
authorl0k1
permlinkre-dragosroua-re-l0k1-a-python-script-that-streams-the-new-blocks-in-json-format-and-how-to-find-full-documentation-for-the-python-steem-library-20170308t085854876z
categorysteem
json_metadata{"tags":["steem"],"app":"steemit/0.1"}
created2017-03-08 08:58:57
last_update2017-03-08 08:58:57
depth2
children6
last_payout2017-04-08 09:28:30
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length848
author_reputation94,800,257,230,993
root_title"A python script that streams the new blocks in JSON format - and how to find full documentation for the python steem library"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id2,671,158
net_rshares0
@dragosroua ·
Hmmm, I don't think it's because of Piston, in this case. If different nodes are allowing you to do different things, it must be from the nodes themselves, not from Piston. 

My guess is that node.steem.ws runs a broader set of APIs, possibly some related to accounts (don't have time to dig to see which plugins are related to accounts, but I know it was a discussion on github about this). That means you can set up your own Steem seed node, enable the plugins related to accounts, and interact with it instead of sending transactions to node.steem.ws (and increasing the load on it). If you configure your seed node properly it will take care of all the necessary operations, including broadcasting transactions, etc.

Hope it helps.
👍  
properties (23)
authordragosroua
permlinkre-l0k1-re-dragosroua-re-l0k1-a-python-script-that-streams-the-new-blocks-in-json-format-and-how-to-find-full-documentation-for-the-python-steem-library-20170308t092906608z
categorysteem
json_metadata{"tags":["steem"],"app":"steemit/0.1"}
created2017-03-08 09:29:06
last_update2017-03-08 09:29:06
depth3
children5
last_payout2017-04-08 09:28:30
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length736
author_reputation372,798,229,806,288
root_title"A python script that streams the new blocks in JSON format - and how to find full documentation for the python steem library"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id2,671,285
net_rshares189,528,437,001
author_curate_reward""
vote details (1)
@l0k1 ·
Yes, I have my own RPC and just finished pulling down from my server a snapshot that I will also be able to run on my laptop and when offline still test code that talks to it.

No, there seems to be a bug in a fresh clean install of python with the steem library... the names are confusing me. It is called 'steem' now, just steem: `pip install steem`. But `piston` does not work saying it is missing an import of some exception definition.

I am writing code for automating blockchain related things so the model with the piston wallet doesn't really suit my purposes, I have to create instances of the `Steem` class that define the RPC node and a key for something. I am not sure what to use but it accepts my memo key.

I actually just discovered I can pull the data I am looking for with a simple curl command:

curl https://node.steem.ws --data  '{"id":8,"method":"get_witnesses_by_vote","params":["","100"]}'

This spits forth the entire data for all 100 current witnesses in JSON format. I think the same parameter can be used with python `requests` library as well.
properties (22)
authorl0k1
permlinkre-dragosroua-re-l0k1-re-dragosroua-re-l0k1-a-python-script-that-streams-the-new-blocks-in-json-format-and-how-to-find-full-documentation-for-the-python-steem-library-20170308t094632237z
categorysteem
json_metadata{"tags":["steem"],"links":["https://node.steem.ws"],"app":"steemit/0.1"}
created2017-03-08 09:46:36
last_update2017-03-08 09:46:36
depth4
children4
last_payout2017-04-08 09:28:30
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,073
author_reputation94,800,257,230,993
root_title"A python script that streams the new blocks in JSON format - and how to find full documentation for the python steem library"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id2,671,331
net_rshares0