SteemPY Tutorials #2 - Basic Functions

Words
318
Reading
2 min
Listen
Play
8y


Hello, steemians.
This is a new tutorial series on accessing Steem blockchain using python programming language.

Repository

Requirements

  • Python

Difficulty

  • Basic

Tutorial Contents

  • You will learn how to install the official steem-py to your windows and use it via CMD(command line)

Curriculum

The Tutorial

Import the Steem function from steem library. After importing, we can use the function to access further commands (variables) inside that function.

>>> from steem import Steem
>>> s = Steem()

All keys

Using all keys, we can query.

>>> s.get_account('lonelywolf').keys()

image.png

Id

This represents the 'user id' of the steem account holder. This is assigned whenever the user joins for 1st time and it remains permanent for the 'username'

>>> s.get_account('lonelywolf')['id']
231859

Name

>>> s.get_account('lonelywolf')['name']
'lonelywolf'

Owner, Active, Posting, Memo Keys

Here, all the keys required to access account's different features.

  • Owner
>>> s.get_account('lonelywolf')['owner']
{'weight_threshold': 1, 'account_auths': [], 'key_auths': [['**************************************************', 1]]}
  • Active
>>> s.get_account('lonelywolf')['active']
{'weight_threshold': 1, 'account_auths': [], 'key_auths': [['**************************************************', 1]]}
  • Posting
>>> s.get_account('lonelywolf')['posting']
{'weight_threshold': 1, 'account_auths': [], 'key_auths': [['**************************************************', 1]]}
  • Memo
>>> s.get_account('lonelywolf')['memo_key']
'**************************************************'

Proxy

It is null in this case as no proxy server used.

>>> s.get_account('lonelywolf')['proxy']
''

Last owner update

It comes from the UNIX command i.e. January 1st 1970. Also birthdays are written in timestamps (time from this date till date).

>>> s.get_account('lonelywolf')['last_owner_update']
'1970-01-01T00:00:00'

Last account update

It mainly is when the account settings (public profile) was last updated.

>>> s.get_account('lonelywolf')['last_account_update']
'2018-11-13T17:57:18'

Account creation time

The date, time when the account was created.

>>> s.get_account('lonelywolf')['created']
'2017-10-09T08:00:57'

Recovery account

If your account gets hacked, it can be recovered before any data is manipulated.

>>> s.get_account('lonelywolf')['recovery_account']
'steem'
>>> s.get_account('lonelywolf')['last_account_recovery']
'1970-01-01T00:00:00'

Click here for details.

Post counts

The no. of posts posted by the user.

>>> s.get_account('lonelywolf')['post_count']
142

Can vote

Whether a person can vote or not.

>>> s.get_account('lonelywolf')['can_vote']
True

Voting Power

This depends upon the 'steem power' a user holds. Here, it calculates out of 10,000.

>>> s.get_account('lonelywolf')['voting_power']
9715

So, I hold 97.15 % voting power currently.

Last vote time

Last time, I voted.

>>> s.get_account('lonelywolf')['last_vote_time']
'2018-11-23T11:50:27'

Balance

All balances in steem, SBD.
The user account looks like this...
wallet.png

>>> s.get_account('lonelywolf')['balance']
'0.000 STEEM'

>>> s.get_account('lonelywolf')['sbd_balance']
'0.000 SBD'

>>> s.get_account('lonelywolf')['savings_sbd_balance']
'0.000 SBD'

Witness votes

The witnesses I have voted for.

>>> s.get_account('lonelywolf')['witness_votes']
['steemed', 'utopian-io', `imacryptorick`]

That's all for this tutorial, stay tuned for the next tutorials.

Proof of Work Done

GitHub: https://github.com/lonelywolf1

SteemPY Tutorials #2 - Basic Functions | Ecency