<div class="pull-left"><h1>I</h1></div> <br />had been having a bit of trouble trying to get the python steem library to work, but I have made a breakthrough. I have also learned a couple of neat python tricks for finding out things about libraries you have imported what is inside them and even their documentation (it even is displayed in a pager so you can browse it). Here is the code that will print out the data of each new block as it comes in: #!/usr/bin/python3 import steem from pprint import pprint st = steem.blockchain.Blockchain ( ) for a in st.blocks(): pprint(a) You can browse the help within the python shell like so: ✘ loki@vaioe ~ python3 Python 3.4.3 (default, Nov 17 2016, 01:08:31) [GCC 4.8.4] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import steem >>> help (steem) >>> help (steem.blockchain) In the first you see a list of all the submodules, and then you can add that with a '.' between and get more info. ## Update: This was what I am working towards, now I can grab the current data, so I can process it and generate something from it: #!/usr/bin/python3 import requests import json r = requests.post ( 'https://node.steem.ws', data = '{"id":8,"method":"get_witnesses_by_vote","params":["","100"]}' ) output = json.loads ( r.text ) print ( output ) The output is a bit different to using curl to make the same request: curl https://node.steem.ws --data '{"id":8,"method":"get_witnesses_by_vote","params":["","100"]}' But the content is the same otherwise. This particular function is missing from @xeroc's steem (formerly piston) library, this is why I have had to learn how to write the requests. This site helped a lot: <a href='http://steemroll.io/api-explorer/#method=get_witnesses_by_vote¶ms=["","100"]'>http://steemroll.io/api-explorer/#method=get_witnesses_by_vote¶ms=["","100"]</a> Yes, that is the same query but through the api explorer. Nice huh? <div class="pull-right">😎</div><br /><hr /> <center><code>We can't code here! This is Whale country!</code></center> <div class="pull-left"><a href="https://steemit.com/@l0k1"><img src="http://s20.postimg.org/igf27v79p/signature_new_small.png" /></a></div> <h2>Vote #1 <code>l0k1</code></h2><sub>Go to <a href="https://steemit.com/~witnesses">steemit.com/~witnesses</a> to cast your vote by typing <code>l0k1</code> into the text entry at the bottom of the leaderboard.</sub> <sub>(note, my username is spelled <code>El Zero Kay One</code> or <code>Lima Zero Kilo One</code>, all lower case)</sub> </div>
author | l0k1 |
---|---|
permlink | a-python-script-that-streams-the-new-blocks-in-json-format-and-how-to-find-full-documentation-for-the-python-steem-library |
category | steem |
json_metadata | {"tags":["steem","python","piston","coding"],"image":["http://s20.postimg.org/igf27v79p/signature_new_small.png"],"links":["http://steemroll.io/api-explorer/#method=get_witnesses_by_vote¶ms=[\"\",\"100\"]","https://steemit.com/@l0k1","https://steemit.com/~witnesses"],"app":"steemit/0.1","format":"markdown","users":["xeroc"]} |
created | 2017-03-08 07:53:42 |
last_update | 2017-03-08 09:54:51 |
depth | 0 |
children | 8 |
last_payout | 2017-04-08 09:28:30 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.484 HBD |
curator_payout_value | 0.070 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 2,663 |
author_reputation | 94,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_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 2,670,913 |
net_rshares | 7,426,409,166,275 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
sandra | 0 | 71,607,269,878 | 80% | ||
ihashfury | 0 | 82,837,874,964 | 55.2% | ||
wang | 0 | 153,687,967,030 | 1% | ||
jason | 0 | 75,408,925,998 | 55.2% | ||
benjojo | 0 | 1,153,052,976,758 | 100% | ||
pairmike | 0 | 3,734,043,149 | 1% | ||
pheonike | 0 | 19,003,181,732 | 10% | ||
proctologic | 0 | 4,266,123,450 | 1% | ||
konelectric | 0 | 610,924,036 | 1% | ||
hipster | 0 | 766,470,156,031 | 100% | ||
forrestwillie | 0 | 647,314,065 | 1% | ||
cryptoctopus | 0 | 566,787,241,454 | 50% | ||
acidyo | 0 | 77,168,691,305 | 100% | ||
oaldamster | 0 | 57,672,972,333 | 100% | ||
juanmiguelsalas | 0 | 32,356,356,722 | 100% | ||
kenny-crane | 0 | 108,047,453,602 | 100% | ||
andrei | 0 | 245,668,652 | 1% | ||
christoph3 | 0 | 5,087,419,571 | 100% | ||
fyrstikken | 0 | 52,440,658,856 | 1.5% | ||
grey580 | 0 | 374,377,391 | 1% | ||
artem-sokoloff | 0 | 11,973,467,995 | 100% | ||
roelandp | 0 | 247,862,571,034 | 100% | ||
getssidetracked | 0 | 2,184,759,733 | 100% | ||
trees | 0 | 1,718,591,295 | 100% | ||
strawhat | 0 | 2,745,229,349 | 100% | ||
cryptochannel | 0 | 2,810,580,992 | 100% | ||
vi1son | 0 | 36,210,504,888 | 100% | ||
mrgreen | 0 | 4,985,668,519 | 100% | ||
ausbitbank | 0 | 87,785,003,103 | 100% | ||
jamesjarman | 0 | 1,704,904,409 | 1% | ||
juvyjabian | 0 | 37,398,132,665 | 100% | ||
karenmckersie | 0 | 2,108,979,462 | 1% | ||
krystle | 0 | 26,603,280,907 | 100% | ||
rouketas | 0 | 50,429,942 | 100% | ||
me-tarzan | 0 | 115,247,932,660 | 100% | ||
coininstant | 0 | 39,847,843,137 | 100% | ||
ubg | 0 | 588,778,323 | 2% | ||
fubar-bdhr | 0 | 82,923,245,510 | 80% | ||
beowulfoflegend | 0 | 46,266,547,962 | 100% | ||
ellamaeamor | 0 | 583,130,700 | 100% | ||
bola | 0 | 13,744,877,344 | 40% | ||
pokemon | 0 | 284,518,373 | 100% | ||
raymonjohnstone | 0 | 10,276,953,378 | 100% | ||
brianphobos | 0 | 6,213,141,386 | 100% | ||
uwe69 | 0 | 3,619,663,872 | 100% | ||
shortcut | 0 | 52,858,880,423 | 100% | ||
dirty.hera | 0 | 95,432,722 | 50% | ||
dumar022 | 0 | 78,874,040,630 | 100% | ||
timelapse | 0 | 463,059,619 | 1% | ||
steemleak | 0 | 3,276,805,546 | 100% | ||
d3nv3r | 0 | 6,124,164,679 | 100% | ||
velourex | 0 | 35,949,672,849 | 100% | ||
darthnava | 0 | 406,587,814 | 1% | ||
herbertmueller | 0 | 2,405,281,352 | 100% | ||
virtualgrowth | 0 | 4,572,329,692 | 50% | ||
nang1 | 0 | 639,127,597 | 100% | ||
jsantana | 0 | 34,655,890,075 | 100% | ||
steevc | 0 | 41,419,049,202 | 100% | ||
alktoni | 0 | 210,959,920 | 1% | ||
runridefly | 0 | 12,179,973,130 | 37% | ||
barrydutton | 0 | 1,601,292,728 | 1% | ||
steemitguide | 0 | 591,772,898 | 1% | ||
richardcrill | 0 | 1,444,010,080 | 1% | ||
xanoxt | 0 | 23,759,711,839 | 100% | ||
sponge-bob | 0 | 40,001,703,764 | 5% | ||
l0k1 | 0 | 193,414,231,871 | 100% | ||
dailybitcoinnews | 0 | 7,545,846,655 | 50% | ||
patelincho | 0 | 177,139,090 | 1% | ||
brains | 0 | 2,355,161,390 | 5% | ||
bitcoinparadise | 0 | 19,529,043,104 | 100% | ||
inphiknit | 0 | 15,444,942,297 | 81% | ||
dirkzett | 0 | 178,781,386,313 | 100% | ||
ocrdu | 0 | 18,016,734,771 | 50% | ||
koskl | 0 | 14,610,902,560 | 100% | ||
thegame | 0 | 2,288,826,179 | 50% | ||
steembets | 0 | 2,324,377,121 | 50% | ||
dresden | 0 | 34,794,941,450 | 30% | ||
dianargenti | 0 | 8,681,530,786 | 100% | ||
pinc | 0 | 131,329,966 | 100% | ||
slider2990 | 0 | 43,757,925,241 | 100% | ||
created | 0 | 2,034,286,359,965 | 23% | ||
giantbear | 0 | 1,256,454,000 | 1% | ||
stray | 0 | 443,109,776 | 1% | ||
unityofmulti | 0 | 2,107,808,485 | 100% | ||
michaelcorleone | 0 | 1,452,898,010 | 100% | ||
zatrhas | 0 | 4,527,706,707 | 80% | ||
zathras | 0 | 6,870,617,510 | 80% | ||
dragosroua | 0 | 109,297,758,293 | 100% | ||
raluca | 0 | 10,465,480,468 | 100% | ||
daisyd | 0 | 319,510,051 | 1% | ||
steemland.com | 0 | 2,324,586,412 | 50% | ||
juniper | 0 | 1,552,105,709 | 100% | ||
properremake | 0 | 1,491,202,675 | 100% | ||
firaga | 0 | 1,450,550,154 | 100% | ||
fireworks | 0 | 1,576,430,448 | 100% | ||
angel76 | 0 | 14,182,816,738 | 100% | ||
sqube | 0 | 2,973,441,195 | 1% | ||
discipline | 0 | 1,551,397,377 | 100% | ||
stevebj | 0 | 108,230,339 | 100% | ||
coonhunter | 0 | 1,450,606,549 | 100% | ||
poiplu | 0 | 1,533,544,052 | 100% | ||
cloudstrife | 0 | 1,240,927,191 | 100% | ||
steemonme | 0 | 1,387,878,454 | 100% | ||
leaderofleaders | 0 | 1,483,275,545 | 100% | ||
barneyrubble | 0 | 1,425,744,771 | 100% | ||
etotheipi | 0 | 1,416,941,358 | 100% | ||
centeredsoul | 0 | 1,325,668,925 | 100% | ||
rightrythm | 0 | 1,492,874,028 | 100% | ||
ted1984 | 0 | 1,294,383,878 | 100% | ||
smokinhot | 0 | 1,312,866,526 | 100% | ||
whatageek | 0 | 834,778,984 | 1% | ||
chadmoore | 0 | 1,455,204,873 | 100% | ||
batonrouge | 0 | 1,564,844,801 | 100% | ||
onlygooddeals | 0 | 1,463,320,183 | 100% | ||
enrichened | 0 | 1,429,002,932 | 100% | ||
barretwallace | 0 | 1,366,359,912 | 100% | ||
dontbetrippin | 0 | 1,558,128,431 | 100% | ||
glenyven23 | 0 | 1,171,548,588 | 100% | ||
trans-juanmi | 0 | 6,494,461,524 | 60% | ||
j3dy | 0 | 2,278,460,229 | 100% | ||
windows23 | 0 | 1,131,817,333 | 100% | ||
steemquotient | 0 | 1,352,644,757 | 100% | ||
alphalion | 0 | 1,255,194,514 | 100% | ||
moonlanding | 0 | 1,195,946,433 | 100% | ||
loudnoises | 0 | 1,154,385,660 | 100% | ||
breezin | 0 | 1,289,773,741 | 50% | ||
smoothcriminal | 0 | 1,147,972,051 | 100% | ||
eternalfreedom | 0 | 1,321,737,315 | 100% | ||
steemitalpha | 0 | 1,304,481,586 | 100% | ||
lockandkeys | 0 | 1,424,593,655 | 100% | ||
sweetonion | 0 | 1,475,005,483 | 100% | ||
copyandpaste | 0 | 1,260,141,358 | 100% | ||
juices | 0 | 1,505,816,775 | 100% | ||
countdracula | 0 | 1,204,439,720 | 100% | ||
pawntod4 | 0 | 1,114,151,597 | 100% | ||
undertale | 0 | 1,286,114,716 | 100% | ||
steemer0815 | 0 | 874,278,263 | 100% | ||
commenthunter | 0 | 1,483,485,432 | 100% | ||
maxedoutstats | 0 | 1,391,326,574 | 100% | ||
gutzofter | 0 | 71,672,868,721 | 100% | ||
steemprentice | 0 | 19,427,301,026 | 50% | ||
ourlifestory | 0 | 43,442,565,460 | 100% | ||
taskmanager | 0 | 61,726,832,068 | 100% | ||
qubes | 0 | 23,137,329,217 | 100% | ||
juliosalas | 0 | 934,827,441 | 60% | ||
meysam | 0 | 549,762,284 | 1% | ||
kyra-kristian | 0 | 66,470,224 | 100% | ||
jphenderson | 0 | 452,947,460 | 50% | ||
tamersameeh | 0 | 537,053,407 | 100% | ||
beerbot | 0 | 4,253,427,008 | 80% | ||
driptorchpress | 0 | 86,753,910 | 1% | ||
zkalemiss | 0 | 771,137,991 | 100% | ||
dzone | 0 | 20,761,688,872 | 50% | ||
thedeplorable1 | 0 | 553,953,293 | 1% | ||
smalltalk | 0 | 347,397,033 | 20% | ||
honusurf | 0 | 10,685,665,824 | 100% | ||
benjiparler | 0 | 362,118,598 | 100% | ||
denmarkguy | 0 | 427,216,057 | 1% | ||
mestyz | 0 | 60,769,382 | 50% | ||
ambyr00 | 0 | 6,028,748,426 | 50% | ||
kamidela | 0 | 51,025,493 | 100% | ||
evildeathcore | 0 | 332,293,285 | 100% | ||
lovecoins | 0 | 211,346,565 | 100% | ||
robvanvarenberg | 0 | 1,227,867,856 | 100% | ||
mishabux | 0 | 276,807,097 | 100% | ||
wonderhome | 0 | 0 | 100% |
Nifty! :) I just saw the `We can't code here` thing and I had to agree completely. :)
author | dragosroua |
---|---|
permlink | re-l0k1-a-python-script-that-streams-the-new-blocks-in-json-format-and-how-to-find-full-documentation-for-the-python-steem-library-20170308t080638416z |
category | steem |
json_metadata | {"tags":["steem"],"app":"steemit/0.1"} |
created | 2017-03-08 08:06:39 |
last_update | 2017-03-08 08:06:39 |
depth | 1 |
children | 7 |
last_payout | 2017-04-08 09:28:30 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 85 |
author_reputation | 372,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_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 2,670,951 |
net_rshares | 193,414,002,934 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
l0k1 | 0 | 193,414,002,934 | 100% |
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.
author | l0k1 |
---|---|
permlink | 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-20170308t085854876z |
category | steem |
json_metadata | {"tags":["steem"],"app":"steemit/0.1"} |
created | 2017-03-08 08:58:57 |
last_update | 2017-03-08 08:58:57 |
depth | 2 |
children | 6 |
last_payout | 2017-04-08 09:28:30 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 848 |
author_reputation | 94,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_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 2,671,158 |
net_rshares | 0 |
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.
author | dragosroua |
---|---|
permlink | 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-20170308t092906608z |
category | steem |
json_metadata | {"tags":["steem"],"app":"steemit/0.1"} |
created | 2017-03-08 09:29:06 |
last_update | 2017-03-08 09:29:06 |
depth | 3 |
children | 5 |
last_payout | 2017-04-08 09:28:30 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 736 |
author_reputation | 372,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_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 2,671,285 |
net_rshares | 189,528,437,001 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
l0k1 | 0 | 189,528,437,001 | 100% |