Steem-python Step by Step: #1 Getting started
An easy introduction to begin to take advantage of the official STEEM library for Python and the Command Line Interface, steempy, to improve ourselves in Steemit.
Requirements
- Install Python3 from https://www.python.org/.
- Your operating system, preferably Linux, if you use Windows then install Python3 (requires Python 3.5 or higher) with Anaconda from https://www.continuum.io/downloads and It is no longer necessary point 1.
- For wallet and query operations, an austere computer is enough; i.e., from 1GB RAM, 1.6 GHz CPU, it's OK.
Easy Installation
From your Console an internet connection do:
$pip install steem
In the future to keep steem-python updated:
$pip install -U steem
The library is under active development in https://github.com/steemit/steem-python
First steps
Testing the steem-python installation
If you need more background on the Python language:
Then let's start with the python console, on your system terminal :
$python
From python3:
>>>from steem import Steem
>>>s = Steem()
>>>s.get_account('jesuscirino')['sbd_balance'] #show SBD balance of the user jesuscirino
>>>'2.980 SBD'
>>>s.get_account('jesuscirino')['upvoting_power'] #show upvote power of the user jesuscirino
>>>9950
>>>s.get_account('jesuscirino').keys() #show all you can query about jesuscirino
dict_keys([ ...
... ... ...
... ])
>>>exit() #If everything works, then for now it's enough python
Testing the CLI utility steempy
Steem-python comes with a BIP38 encrypted wallet and a practical CLI utility called steempy. Open your operating system terminal for test it.
Set a passphrase for steempy use:
$steempy changewalletpassphrase
Now import your Steem account:
$steempy importaccount "youraccount"
Show balances or you can add more than one:
$steempy balance "youraccount" "otheraccount" "other"
List accounts:
steempy listaccounts
Show help:
steempy -h
To identifying results in steemit platform see example with my account, in the CLI:
In steemit:
On steemd, about balance:
References and thanks
For next blogs I will show more practical examples, different from some very good ones that exist in http://steem.readthedocs.io/en/latest/examples.html
Can not get Steem module to install
Does steempy have a way of transfering steem dollars?
Thanks for this tutorial. This was a beautiful precursor to the steem.readthedocs.io you filled in some questions I had.
Nice good info for the IT guys like me.
The following will be more practical, the goal is for us to learn, thanks
Congratulations @jesuscirino! You have completed some achievement on Steemit and have been rewarded with new badge(s) :
Award for the number of comments
Click on any badge to view your own Board of Honnor on SteemitBoard.
For more information about SteemitBoard, click here
If you no longer want to receive notifications, reply to this comment with the word
STOP
By upvoting this notification, you can help all Steemit users. Learn how here!
Looks good. I am very interested in seeing more advanced coding! :)
I'm preparing the next post, with something more elaborate, but open to everyone who gives you the application that most need, greetings
Nice guide. You want to contribute it to Steem Docs ?
I would like very much, how can we start? I like your project.
Ping me at the steemit.chat..
I love steempy! No more cli_wallet complications and timeouts.
Something is broken. When I try a simple command that used to work, e.g., "steempy listaccounts", I get a bunch of connection errors.
WARNING:urllib3.connectionpool:Retrying (Retry(total=19, connect=None, read=None, redirect=0, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7fae0dbb4278>: Failed to establish a new connection: [Errno -5] No address associated with hostname',)': /
It spits a bunch of these out, counting from 19 down to 0, and then starts over at 19 again. Never progresses.
This used to work in the VM I had set it up in. Did they change the resources that are pointed at by default to not function, or something?
Would reinstalling a portion of what I had installed, make it work again?
Appreciate any pointers, thanks!
FYI, I found the fix. Searched for "python command line steem example no address associated with hostname" and found this: https://github.com/steemit/steem-python/issues/14
The fix is simple, just run this from a terminal prompt: "steempy set nodes https://api.steemit.com"
Now, "steempy listaccounts" works again.
Great! Thanks @libertyteeth.