create account

Daily Puzzle by steempytutorials

View this thread on: hive.blogpeakd.comecency.com
· @steempytutorials ·
$0.52
Daily Puzzle
<center>![steem-python.png](https://res.cloudinary.com/hpiynhbhq/image/upload/v1515886103/kmzfcpvtzuwhvqhgpyjp.png)</center>

For each tutorial we release there will be a relevant challenge where the winner receives 1 STEEM! 

### Challenge

Today's challenge is relatively simple. Take the code from the tutorial, that can be found [here](https://github.com/amosbastian/steempy-tutorials/blob/master/part_4/voting_trail.py), and add the following checks when you upvote a post:

1. Make sure the post is at least 30 minutes old

That's it! Good luck to everyone participating!

### Deadline
The prize money will be rewarded to the person that solve the problem first. If there is no solution within 7 days after this post has been submitted the prize pool expires.

### Relevant Tutorial

[Part 4: How To Follow A Voting Trail Using Steem-Python](https://steemit.com/utopian-io/@steempytutorials/part-4-how-to-follow-a-voting-trail-using-steem-python)

---

If you have questions about the tutorial or the challenge then don't hesitate to comment below or contact us on [Discord](https://discord.gg/rYTV87W)!
👍  , , , , , ,
properties (23)
authorsteempytutorials
permlinkdaily-puzzle-201801160600553884
categorybot
json_metadata"{"tags": ["bot", "programming", "python", "contest", "community"]}"
created2018-01-16 05:00:57
last_update2018-01-16 05:00:57
depth0
children15
last_payout2018-01-23 05:00:57
cashout_time1969-12-31 23:59:59
total_payout_value0.418 HBD
curator_payout_value0.102 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,110
author_reputation31,094,047,689,691
root_title"Daily Puzzle"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id29,861,532
net_rshares56,048,024,169
author_curate_reward""
vote details (7)
@emrebeyler ·
$0.10
[My solution](https://gist.github.com/emre/bdcca8de5b9506516f3be8c6efc26446)
👍  ,
properties (23)
authoremrebeyler
permlinkre-steempytutorials-daily-puzzle-201801160600553884-20180117t213741113z
categorybot
json_metadata{"tags":["bot"],"links":["https://gist.github.com/emre/bdcca8de5b9506516f3be8c6efc26446"],"app":"steemit/0.1"}
created2018-01-17 21:37:42
last_update2018-01-17 21:37:42
depth1
children3
last_payout2018-01-24 21:37:42
cashout_time1969-12-31 23:59:59
total_payout_value0.094 HBD
curator_payout_value0.004 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length76
author_reputation448,528,959,341,273
root_title"Daily Puzzle"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id30,259,951
net_rshares12,356,213,583
author_curate_reward""
vote details (2)
@amosbastian ·
It's not completely right, read the post carefully ;)
properties (22)
authoramosbastian
permlinkre-emrebeyler-re-steempytutorials-daily-puzzle-201801160600553884-20180118t130510656z
categorybot
json_metadata{"tags":["bot"],"app":"steemit/0.1"}
created2018-01-18 13:05:09
last_update2018-01-18 13:05:09
depth2
children2
last_payout2018-01-25 13:05: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_length53
author_reputation174,473,586,900,705
root_title"Daily Puzzle"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id30,390,308
net_rshares0
@emrebeyler ·
$0.04
aww, updated. :)
👍  
properties (23)
authoremrebeyler
permlinkre-amosbastian-re-emrebeyler-re-steempytutorials-daily-puzzle-201801160600553884-20180118t162743642z
categorybot
json_metadata{"tags":["bot"],"app":"steemit/0.1"}
created2018-01-18 16:27:42
last_update2018-01-18 16:27:42
depth3
children1
last_payout2018-01-25 16:27:42
cashout_time1969-12-31 23:59:59
total_payout_value0.030 HBD
curator_payout_value0.008 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length16
author_reputation448,528,959,341,273
root_title"Daily Puzzle"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id30,430,435
net_rshares5,107,568,208
author_curate_reward""
vote details (1)
@matriks77 · (edited)
Did u Mean like this?

from steem import Steem
from steem.blockchain import Blockchain
from steem.post import Post

voting_trail = ["amosbastian", "juliank"]
template = "@{}/{}"

steem = Steem()
blockchain = Blockchain()
stream = blockchain.stream(filter_by=["vote"])

if __name__ == '__main__':
    while True:
        try:
            for vote in stream:
                voter = vote["voter"]
                author = vote["author"]
                permlink = vote["permlink"]

                if voter in voting_trail:
                    post = template.format(author, permlink)
                    if Post(post).is_main_post():
                        print("Voting on {} post that {} voted on!".format(
                            permlink, voter))
                        steem.vote(post, 100)
        except Exception as error:
            print(repr(error))
            continue
properties (22)
authormatriks77
permlinkre-steempytutorials-daily-puzzle-201801160600553884-20180116t053223640z
categorybot
json_metadata{"tags":["bot"],"app":"steemit/0.1"}
created2018-01-16 05:32:27
last_update2018-01-16 05:33:09
depth1
children2
last_payout2018-01-23 05:32:27
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_length887
author_reputation386,727,893,620
root_title"Daily Puzzle"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id29,866,034
net_rshares0
@amosbastian ·
Well, you didn't change anything about the given code, so not exactly. Try and complete the challenge and either upload it to GitHub, create a Gist or paste it pastebin or something and link that here, good luck!
properties (22)
authoramosbastian
permlinkre-matriks77-re-steempytutorials-daily-puzzle-201801160600553884-20180116t093533456z
categorybot
json_metadata{"tags":["bot"],"app":"steemit/0.1"}
created2018-01-16 09:35:33
last_update2018-01-16 09:35:33
depth2
children1
last_payout2018-01-23 09:35:33
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_length212
author_reputation174,473,586,900,705
root_title"Daily Puzzle"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id29,901,314
net_rshares0
@matriks77 ·
Thanks, But actually, I'm not sure what I have to do with It code, I will try!!!
properties (22)
authormatriks77
permlinkre-amosbastian-re-matriks77-re-steempytutorials-daily-puzzle-201801160600553884-20180116t113253992z
categorybot
json_metadata{"tags":["bot"],"app":"steemit/0.1"}
created2018-01-16 11:33:00
last_update2018-01-16 11:33:00
depth3
children0
last_payout2018-01-23 11:33:00
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_length80
author_reputation386,727,893,620
root_title"Daily Puzzle"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id29,919,319
net_rshares0
@sumdumphok ·
Hi, I gave this a try and I have to admit that it is pretty hard. Had to look up Steem documentation and also datetime.

My solution is below:
https://pastebin.com/tzshQXXb

Thank you for making me learn new things.
properties (22)
authorsumdumphok
permlinkre-steempytutorials-daily-puzzle-201801160600553884-20180117t064447431z
categorybot
json_metadata{"tags":["bot"],"links":["https://pastebin.com/tzshQXXb"],"app":"steemit/0.1"}
created2018-01-17 06:44:48
last_update2018-01-17 06:44:48
depth1
children5
last_payout2018-01-24 06:44:48
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_length215
author_reputation412,722,608,537
root_title"Daily Puzzle"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id30,108,763
net_rshares0
@amosbastian ·
You nearly got it! It's not completely right, so try again if you want to.
👍  
properties (23)
authoramosbastian
permlinkre-sumdumphok-re-steempytutorials-daily-puzzle-201801160600553884-20180118t130428484z
categorybot
json_metadata{"tags":["bot"],"app":"steemit/0.1"}
created2018-01-18 13:04:27
last_update2018-01-18 13:04:27
depth2
children3
last_payout2018-01-25 13:04:27
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_length74
author_reputation174,473,586,900,705
root_title"Daily Puzzle"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id30,390,182
net_rshares643,315,190
author_curate_reward""
vote details (1)
@sumdumphok ·
https://pastebin.com/p6vL4vQ4
properties (22)
authorsumdumphok
permlinkre-amosbastian-re-sumdumphok-re-steempytutorials-daily-puzzle-201801160600553884-20180118t174843163z
categorybot
json_metadata{"tags":["bot"],"links":["https://pastebin.com/p6vL4vQ4"],"app":"steemit/0.1"}
created2018-01-18 17:48:42
last_update2018-01-18 17:48:42
depth3
children2
last_payout2018-01-25 17:48:42
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_length29
author_reputation412,722,608,537
root_title"Daily Puzzle"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id30,445,974
net_rshares0
@sumdumphok · (edited)
Also, for future reference, do these snippets have to compile or how does "grading" work? Since the next challenge requires sending money to upvote bots, do I just find the closest match solution or it has to actually send money to upvote bots?
properties (22)
authorsumdumphok
permlinkre-sumdumphok-re-steempytutorials-daily-puzzle-201801160600553884-20180117t064800316z
categorybot
json_metadata{"tags":["bot"],"app":"steemit/0.1"}
created2018-01-17 06:48:00
last_update2018-01-17 06:48:33
depth2
children0
last_payout2018-01-24 06:48:00
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_length244
author_reputation412,722,608,537
root_title"Daily Puzzle"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id30,109,236
net_rshares0
@yura81 ·
I will upvote old posts manually)
properties (22)
authoryura81
permlinkre-steempytutorials-daily-puzzle-201801160600553884-20180116t095353533z
categorybot
json_metadata{"tags":["bot"],"app":"steemit/0.1"}
created2018-01-16 09:52:24
last_update2018-01-16 09:52:24
depth1
children1
last_payout2018-01-23 09:52:24
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_length33
author_reputation298,771,669,778
root_title"Daily Puzzle"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id29,903,876
net_rshares0
@juliank · (edited)
Feel free to do so ;)
properties (22)
authorjuliank
permlinkre-yura81-re-steempytutorials-daily-puzzle-201801160600553884-20180116t111456042z
categorybot
json_metadata{"tags":["bot"],"app":"steemit/0.1"}
created2018-01-16 11:14:54
last_update2018-01-16 11:15:00
depth2
children0
last_payout2018-01-23 11:14:54
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_length21
author_reputation117,823,071,447,502
root_title"Daily Puzzle"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id29,916,457
net_rshares0