SteemPY Tutorials #2 - Basic Functions

in #utopian-io5 years ago


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

Sort:  

Your contribution has been found to be plagiarized from the following source here.
Plagiarism is a serious offense. Your account has been accordingly banned from receiving utopian reviews.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

Thank you for your review, @portugalcoin! Keep up the good work!

very good post👍😍

Hi, @lonelywolf!

You just got a 0.53% upvote from SteemPlus!
To get higher upvotes, earn more SteemPlus Points (SPP). On your Steemit wallet, check your SPP balance and click on "How to earn SPP?" to find out all the ways to earn.
If you're not using SteemPlus yet, please check our last posts in here to see the many ways in which SteemPlus can improve your Steem experience on Steemit and Busy.

Congratulations @lonelywolf! You received a personal award!

1 Year on Steemit

Click here to view your Board of Honor

Support SteemitBoard's project! Vote for its witness and get one more award!

Coin Marketplace

STEEM 0.29
TRX 0.11
JST 0.033
BTC 63945.57
ETH 3135.76
USDT 1.00
SBD 4.00