Steem-python Step by Step: #1 Getting started

in #spam7 years ago

portadaStepbystep.png

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

  1. Install Python3 from https://www.python.org/.
  2. 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.
  3. 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:

  1. Then let's start with the python console, on your system terminal :
    $python

  2. 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.

  1. Set a passphrase for steempy use:
    $steempy changewalletpassphrase

  2. Now import your Steem account:
    $steempy importaccount "youraccount"

  3. Show balances or you can add more than one:
    $steempy balance "youraccount" "otheraccount" "other"

  4. List accounts:
    steempy listaccounts

  5. Show help:
    steempy -h

To identifying results in steemit platform see example with my account, in the CLI:
list.png

In steemit:
walletKeys.PNG

On steemd, about balance:veststeemd.PNG

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

Sort:  

Hi! I am a robot. I just upvoted you! I found similar content that readers might be interested in:
https://steemit.com/steem-dev/@jesuscirino/steem-python-step-by-step-1-getting-started