Hi Guys!!...
Today in this tutorial, we will learn about few basic commands for programming the Steem blockchain using Python language.
Please, refer to Part 1 before going any further, if the required tools are not installed.
Introduction
This is all about practising the basic commands of "Steem-Python".
Basic commands
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('abhi3700').keys()
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('abhi3700')['id']
143518
Name
>>> s.get_account('abhi3700')['name']
'abhi3700'
Owner, Active, Posting, Memo Keys
Here, all the keys required to access account's different features.
Owner
>>> s.get_account('abhi3700')['owner']
{'weight_threshold': 1, 'account_auths': [], 'key_auths': [['**************************************************', 1]]}
Active
>>> s.get_account('abhi3700')['active']
{'weight_threshold': 1, 'account_auths': [], 'key_auths': [['**************************************************', 1]]}
Posting
>>> s.get_account('abhi3700')['posting']
{'weight_threshold': 1, 'account_auths': [['utopian.app', 1]], 'key_auths': [['**************************************************', 1]]}
Memo
>>> s.get_account('abhi3700')['memo_key']
'**************************************************'
Public Profile Settings
This shows the meta-data about the user.
>>> s.get_account('abhi3700')['json_metadata']
'{"profile":{"name":"Abhijit Roy","about":"A Software Developer, Traveller, Crypto Trader, Blockchain enthusiast","location":"Chandigarh, India","profile_image":"https://firebasestorage.googleapis.com/v0/b/bitinfocoinfree.appspot.com/o/14068548_1125160424216001_2627046384272844500_o.jpg?alt=media&token=8bb1b1f9-36f5-4b9a-8220-4134f01f8542","website":"https://play.google.com/store/apps/details?id=in.topux.bitinfocoin","cover_image":"https://www.ethereum.org/images/assets/1900/Ethereum-homestead-background-4.jpg"}}'
Proxy
It is null in this case as no proxy server used.
>>> s.get_account('abhi3700')['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('abhi3700')['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('abhi3700')['last_account_update']
'2017-11-26T17:57:18'
Account creation time
The date, time when the account was created.
>>> s.get_account('abhi3700')['created']
'2017-04-02T08:00:57'
Recovery account
If your account gets hacked, it can be recovered before any data is manipulated.
>>> s.get_account('abhi3700')['recovery_account']
'steem'
>>> s.get_account('abhi3700')['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('abhi3700')['post_count']
198
Can vote
Whether a person can vote or not.
>>> s.get_account('abhi3700')['can_vote']
True
Voting Power
This depends upon the 'steem power' a user holds. Here, it calculates out of 10,000.
>>> s.get_account('abhi3700')['voting_power']
9800
So, I hold 98 % voting power currently.
Last vote time
Last time, I voted.
>>> s.get_account('abhi3700')['last_vote_time']
'2017-12-01T18:30:27'
Balance
All balances in steem, SBD.
The user account looks like this...
>>> s.get_account('abhi3700')['balance']
'0.000 STEEM'
>>> s.get_account('abhi3700')['sbd_balance']
'0.603 SBD'
>>> s.get_account('abhi3700')['savings_sbd_balance']
'0.000 SBD'
Vesting
Basically, it defines the steem power.
Click here for details.
>>> s.get_account('abhi3700')['vesting_shares']
'1038936.179712 VESTS'
>>> s.get_account('abhi3700')['delegated_vesting_shares']
'0.000000 VESTS'
>>> s.get_account('abhi3700')['received_vesting_shares']
'12358.959056 VESTS'
>>> s.get_account('abhi3700')['vesting_withdraw_rate']
'0.000000 VESTS'
>>> s.get_account('abhi3700')['next_vesting_withdrawal']
'1969-12-31T23:59:59'
Basically, I have never withdrawn my steem-power. The time itself indicates i.e. before Jan 1, 1970 ())
Bandwidth
It is the power to post, upvote, comment. The more Steem-power one has, the more steem-blockchain's bandwidth is owned by the user.
It is like holding a percent of the network.
# Content post bandwidth
>>> s.get_account('abhi3700')['average_bandwidth']
'46792401000'
>>> s.get_account('abhi3700')['lifetime_bandwidth']
'677875000000'
>>> s.get_account('abhi3700')['last_bandwidth_update']
'2017-12-06T20:42:42'
**************************************************************************************************
# Market bandwidth
>>> s.get_account('abhi3700')['average_market_bandwidth']
1660341514
>>> s.get_account('abhi3700')['lifetime_market_bandwidth']
'24130000000'
>>> s.get_account('abhi3700')['last_market_bandwidth_update']
'2017-12-06T20:42:42'
Last post date
The date, time for last post.
>>> s.get_account('abhi3700')['last_post']
'2017-12-03T13:20:21'
Witness votes
The witnesses I have voted for.
>>> s.get_account('abhi3700')['witness_votes']
['steemed', 'utopian-io']
Basically, all the above discussed user properties can be viewed here-(https://steemd.com/@username)
That's all.
Stay tuned for more such tutorials......
View in Github
Posted on Utopian.io - Rewarding Open Source Contributors
You've got a
1UP
from the @utopian-1up curation trail. 22 Utopians have upvoted your quality contribution to the open source community.Join 1UP for better posts and high curation rewards.
1UP is neither organized nor endorsed by Utopian.io!
Thank you for the contribution. It has been approved.
You can contact us on Discord.
[utopian-moderator]
Hey @abhi3700 I am @utopian-io. I have just upvoted you!
Achievements
Community-Driven Witness!
I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!
Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x
Great stuff and good detailled explanations with examples.
Now I have to find how I can use all this.. thanks !