create account

Teaching myself Python Day 7 by mytechtrail

View this thread on: hive.blogpeakd.comecency.com
· @mytechtrail ·
$0.31
Teaching myself Python Day 7
I have to admit todays code is mostly a copy from @felixx homework post. I did change the code to use the steemit api for the data as the default beem api timed out.

I also tried to run the program against the testnet, but it appears that @mytechtrail does not have any data in the database.

![pylearnday7.png](https://files.steempeak.com/file/steempeak/mytechtrail/4B7DUQ9J-pylearn-day7.png)

```python
from beem.account import Account
from beem.blockchain import Blockchain
from beem import Steem
from beem.instance import set_shared_steem_instance

#steemit_api = Steem(node=["https://testnet.steemitdev.com"])
steemit_api = Steem(node=["https://api.steemit.com"])
set_shared_steem_instance(steemit_api)

blockchain = Blockchain()
head_block = blockchain.get_current_block_num()

test_account = Account("mytechtrail")

rewards = []
reward_sum = 0

for curation_reward in test_account.history_reverse(start = head_block, stop = head_block - 30000, use_block_num = True, only_ops = "curation_reward"):
    rewards.append(curation_reward['reward']['amount'])

for reward_num in range(10): # starts at 0
    reward_sum += int(rewards[reward_num])
    print('\n', reward_num + 1, ':',  rewards[reward_num])

print('\naverage:', reward_sum/ 10, '\n... this look like its in VESTS ...')
```
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , ,
properties (23)
authormytechtrail
permlinkteaching-myself-python-day-7
categoryulog
json_metadata{"app":"steempeak/1.19.0","format":"markdown","tags":["ulog","marlians","palnet","python","stem","ctp"],"users":["felixx","mytechtrail"],"links":["/@felixx","/@mytechtrail"],"image":["https://files.steempeak.com/file/steempeak/mytechtrail/4B7DUQ9J-pylearn-day7.png"]}
created2019-11-06 04:40:30
last_update2019-11-06 04:40:30
depth0
children1
last_payout2019-11-13 04:40:30
cashout_time1969-12-31 23:59:59
total_payout_value0.155 HBD
curator_payout_value0.153 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,289
author_reputation18,997,364,795,810
root_title"Teaching myself Python Day 7"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id92,242,129
net_rshares1,581,459,006,866
author_curate_reward""
vote details (28)
@wirago ·
How is your experience so far? Never really got warm with python although I am working with C# and js a lot ^^

Posted using [Partiko Android](https://partiko.app/referral/wirago)
properties (22)
authorwirago
permlinkwirago-re-mytechtrail-teaching-myself-python-day-7-20191106t085034688z
categoryulog
json_metadata{"app":"partiko","client":"android"}
created2019-11-06 08:50:36
last_update2019-11-06 08:50:36
depth1
children0
last_payout2019-11-13 08:50:36
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_length179
author_reputation100,317,999,792,316
root_title"Teaching myself Python Day 7"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id92,246,797
net_rshares0