create account

Python Beem Project: Account Information Part 5 by tomoyan

View this thread on: hive.blogpeakd.comecency.com
· @tomoyan ·
$2.48
Python Beem Project: Account Information Part 5
I have updated my project a bit.
It is kind of nice to know how **HIVE** and **STEEM** are doing so I took some chart widgets from CoinGecko and added to my home page.
Also I have added a "Profile" thing that you can check your account information.
Reputation, voting power, wallet info and delegations.

## https://floating-meadow-28045.herokuapp.com
![ezgif.com-gif-maker.gif](https://images.ecency.com/DQmPYP8ZpjaAiVcMFYTgPEic6HUzVn2ye7ZRJJ5o53Kqcnt/ezgif.com-gif-maker.gif)

UI, layout stuff will probably change again soon since I am going to add information in this page, but it is a nice start.
Design inspirations came from https://hivestats.io/ and https://steemworld.org/ that I use time to time but I don't use all the features. 
I just want some specific information and display it in my way but I like hivestats' clean design so I think it will probably end up looking like to hivestat 🀣 
Hopefully able to add some nice touch to it though πŸ™ˆ πŸ™Š πŸ™‰ 

Main stuff I added was like this πŸ‘‡ 
```
@app.route('/hive/profile', methods=['GET', 'POST'])
def hive_profile():
    form = UserNameForm(request.form)

    if request.method == 'POST':
        if form.validate():
            username = request.form['username'].lower()

            return redirect('/hive/profile/' + username)
        else:
            flash('Username is Required')

    return render_template('hive/profile.html', form=form)


@app.route('/hive/profile/<username>')
@app.route('/hive/profile/<username>/')
def hive_profile_data(username=None):
    data = {}
    if username:
        username = escape(username).lower()
        data = get_user_profile('hive', username)

    logging.warning('get_user_profile')
    logging.warning(data)
    if data:
        return render_template('hive/profile_data.html',
                               username=username, data=data)
    else:
        return render_template('hive/profile_data.html',
                               username=None, data=data)
                               
def get_user_profile(chain_type, username):
    chain = None
    if chain_type == 'hive':
        chain = set_node_list(chain_type='hive')
        chain.is_hive
    elif chain_type == 'steemit':
        chain = set_node_list(chain_type='steemit')
    else:
        return None

    # Create account object
    try:
        account = Account(username)
    except Exception as e:
        logging.warning(e)
        return None

    profile = account.profile

    profile['balances'] = account.get_balances()
    profile['voting_power'] = f"{account.get_voting_power(): .2f}"
    profile['reputation'] = f"{account.get_reputation(): .1f}"

    token_power = account.get_token_power()
    profile['token_power'] = f"{token_power:.3f}"
    logging.warning('token_power')
    logging.warning(token_power)

    # Get delegations
    delegations = account.get_vesting_delegations()
    if delegations:
        profile['delegations'] = get_user_delegations(
            chain, username, delegations)
    else:
        profile['delegations'] = []

    return profile
    
def get_user_delegations(chain, username, delegations):
    # Convert vest to power
    delegation_list = []
    for d in delegations:
        amount = d['vesting_shares']['amount']
        precision = d['vesting_shares']['precision']
        precision = 10 ** precision
        delegatee = d['delegatee']
        vest_amount = float(int(amount) / precision)
        if chain.is_hive:
            delegation_power = f"{chain.vests_to_hp(vest_amount):.3f}"
        elif chain.is_steem:
            delegation_power = f"{chain.vests_to_sp(vest_amount):.3f}"

        delegation_list.append(
            {'delegatee': delegatee, 'amount': delegation_power})

    return delegation_list
```
My stuff is all in here if you like to look at it. 
(please dont. it is a big mess right now lol)
https://github.com/tomoyan/blockchain-tools
<center>
    [Get Rewarded For Browsing! Are you Brave?](https://brave.com/tom490)
    [<img src="https://img.esteem.app/be00j8.png">](https://brave.com/tom490)
    [![happy tears](https://images.ecency.com/DQmUfaVp5UQvASdTyyLrNiBdGB7NxQfxE2wBpNivcDUkCfe/h.gif)](https://tomoyan.github.io/)
    ➑️ [Website](tomoyan.github.io)
    ➑️ [Twitter ](twitter.com/tomoyanTweet)
</center>
πŸ‘  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
πŸ‘Ž  
properties (23)
authortomoyan
permlinkpython-beem-project-account-information-part-5
categorypython
json_metadata{"links":["https://floating-meadow-28045.herokuapp.com","https://hivestats.io/","https://steemworld.org/","https://github.com/tomoyan/blockchain-tools","https://brave.com/tom490","https://brave.com/tom490","https://tomoyan.github.io/"],"image":["https://images.ecency.com/DQmPYP8ZpjaAiVcMFYTgPEic6HUzVn2ye7ZRJJ5o53Kqcnt/ezgif.com-gif-maker.gif","https://img.esteem.app/be00j8.png","https://images.ecency.com/DQmUfaVp5UQvASdTyyLrNiBdGB7NxQfxE2wBpNivcDUkCfe/h.gif"],"users":["app.route","app.route","app.route"],"tags":["python","beem","account","hive","steem","programming","marlians","dblog","palnet","neoxian"],"app":"esteem/2.2.7-surfer","format":"markdown+html","community":"esteem.app"}
created2020-07-30 14:21:36
last_update2020-07-30 14:21:36
depth0
children8
last_payout2020-08-06 14:21:36
cashout_time1969-12-31 23:59:59
total_payout_value1.227 HBD
curator_payout_value1.253 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length4,274
author_reputation144,440,848,820,221
root_title"Python Beem Project: Account Information Part 5"
beneficiaries
0.
accountesteemapp
weight300
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id98,800,849
net_rshares7,766,656,140,005
author_curate_reward""
vote details (65)
@alexbalan ·
$0.02
This is shaping up really great. I really like how it looks now.
πŸ‘  
properties (23)
authoralexbalan
permlinkre-tomoyan-qeahek
categorypython
json_metadata{"tags":["python"],"app":"peakd/2020.07.2"}
created2020-07-30 15:52:15
last_update2020-07-30 15:52:15
depth1
children3
last_payout2020-08-06 15:52:15
cashout_time1969-12-31 23:59:59
total_payout_value0.012 HBD
curator_payout_value0.012 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length64
author_reputation7,291,343,466,873
root_title"Python Beem Project: Account Information Part 5"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id98,802,166
net_rshares116,358,326,675
author_curate_reward""
vote details (1)
@tomoyan ·
really really really 🀩 🀩 🀩
πŸ‘  
properties (23)
authortomoyan
permlinkre-alexbalan-2020730t10278296z
categorypython
json_metadata{"tags":["python"],"app":"esteem/2.2.7-surfer","format":"markdown+html","community":"esteem.app"}
created2020-07-30 17:27:09
last_update2020-07-30 17:27:09
depth2
children2
last_payout2020-08-06 17:27:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length26
author_reputation144,440,848,820,221
root_title"Python Beem Project: Account Information Part 5"
beneficiaries
0.
accountesteemapp
weight300
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id98,803,593
net_rshares2,769,154,189
author_curate_reward""
vote details (1)
@alexbalan ·
$0.02
Oh yeah, it looks great, I like it a lot. πŸ€©πŸ˜„
Oh yeah, it looks great, I like it a lot. πŸ€©πŸ˜„

 Posted using [Dapplr](https://app.dapplr.in/4zPDNkNqqaqkin536)
πŸ‘  
properties (23)
authoralexbalan
permlinkohyeahitlooksgreatilik-526nrd7jc50c5se2hcqjt0ho38tihwfm
categorypython
json_metadata{"app":"dapplr","format":"markdown","tags":["dapplr"],"media":[],"users_tagged":[]}
created2020-07-30 17:56:48
last_update2020-07-30 17:56:48
depth3
children1
last_payout2020-08-06 17:56:48
cashout_time1969-12-31 23:59:59
total_payout_value0.012 HBD
curator_payout_value0.012 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length110
author_reputation7,291,343,466,873
root_title"Python Beem Project: Account Information Part 5"
beneficiaries
0.
accountdapplr
weight500
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id98,804,130
net_rshares115,284,773,992
author_curate_reward""
vote details (1)
@chitty ·
$0.02
I have picked your post for my daily hive voting initiative, Keep it up and Hive On!!
πŸ‘  
properties (23)
authorchitty
permlinkre-python-beem-project-account-information-part-5-20200731t000407
categorypython
json_metadata""
created2020-07-31 00:04:12
last_update2020-07-31 00:04:12
depth1
children1
last_payout2020-08-07 00:04:12
cashout_time1969-12-31 23:59:59
total_payout_value0.012 HBD
curator_payout_value0.012 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length86
author_reputation86,901,300,608,582
root_title"Python Beem Project: Account Information Part 5"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id98,809,048
net_rshares118,577,382,086
author_curate_reward""
vote details (1)
@tomoyan ·
Thank you ☺️ 
properties (22)
authortomoyan
permlinkre-chitty-2020730t19504573z
categorypython
json_metadata{"tags":["esteem"],"app":"esteem/2.2.5-mobile","format":"markdown+html","community":"hive-125125"}
created2020-07-31 02:50:03
last_update2020-07-31 02:50:03
depth2
children0
last_payout2020-08-07 02:50:03
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length13
author_reputation144,440,848,820,221
root_title"Python Beem Project: Account Information Part 5"
beneficiaries
0.
accountesteemapp
weight300
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id98,810,407
net_rshares0
@uthus2k ·
$0.02
This is beginning to intrigued me. What's the language? I'm familiar with perl and PHP and have used them quite a bit. Perl is easier to write, but PHP has better database hooks.
πŸ‘  
properties (23)
authoruthus2k
permlinkre-tomoyan-2020730t163420674z
categorypython
json_metadata{"tags":["python","beem","account","hive","steem","programming","marlians","dblog","palnet","neoxian"],"app":"esteem/2.2.5-mobile","format":"markdown+html","community":"hive-125125"}
created2020-07-30 21:34:21
last_update2020-07-30 21:34:21
depth1
children1
last_payout2020-08-06 21:34:21
cashout_time1969-12-31 23:59:59
total_payout_value0.012 HBD
curator_payout_value0.012 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length178
author_reputation6,252,156,892,182
root_title"Python Beem Project: Account Information Part 5"
beneficiaries
0.
accountesteemapp
weight300
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id98,806,981
net_rshares117,225,565,011
author_curate_reward""
vote details (1)
@tomoyan ·
Looking at other people's wallet is fun right πŸ˜† I am using python. If you know perl and PHP, you can do python too. Pretty easy... similar to perl. I thought you were a brown legged speedo person 😝
πŸ‘  
properties (23)
authortomoyan
permlinkre-uthus2k-2020730t145610845z
categorypython
json_metadata{"tags":["python","beem","account","hive","steem","programming","marlians","dblog","palnet","neoxian"],"app":"esteem/2.2.7-surfer","format":"markdown+html","community":"esteem.app"}
created2020-07-30 21:56:12
last_update2020-07-30 21:56:12
depth2
children0
last_payout2020-08-06 21:56:12
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length197
author_reputation144,440,848,820,221
root_title"Python Beem Project: Account Information Part 5"
beneficiaries
0.
accountesteemapp
weight300
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id98,807,229
net_rshares3,639,887,851
author_curate_reward""
vote details (1)