You are viewing a single comment's thread from:
RE: A python script that streams the new blocks in JSON format - and how to find full documentation for the python steem library
Nifty! :) I just saw the We can't code here
thing and I had to agree completely. :)
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:
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 inSteem
, I am writing a script to grab the data of the active witnesses so I can process the data in the output.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.
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
. Butpiston
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.I think piston library was renamed as pysteem. http://pysteem.com. Piston, as a separate project, seems to be a set of tools for pysteem. I'm using pysteem on a Steem reated projects and it works out of the box (sometimes it's broken, I admit it, but now seems to be one of those times where it seems to just work).
pip3 install pysteem, or just read the docs at the site above.
The library originally was part of
piston
, then became pysteem. However, due to trademakr limitations, I have just recently moved over to piston-lib which will be a distinct brandinghttps://steemit.com/chainsquad/@chainsquad/python-steem-rebranding-to-piston-libpiston-cli
✘ loki@vaioe ~ sudo -H pip3 install pysteem
Collecting pysteem
Could not find a version that satisfies the requirement pysteem (from versions: )
No matching distribution found for pysteem
it is called
piston-lib
possibly. Or something. I've poked around and I have piston now but it is flagging another error:steem
is installed and I can use it in scripts like the ones above but I am just going to stick with requests because the function I require is missing from @xeroc's library.I have seen that error aswell, but it should be fixed by now.
Make sure follow the instructions here:
@l0k1