Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions bin/dice_simulator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import random # random is a python built-in module


def roll_dice():
dice_side = random.randrange(1, 7)
print(dice_side)


if __name__ == '__main__':
roll_dice()
31 changes: 31 additions & 0 deletions bin/twitter_retweet_bot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import tweepy # This is a Twitter API helper library.
import time


# You should get the following keys and authentication codes for your Twitter account
# Visit apps.twitter.com
consumer_key = 'consumer_key'
consumer_secret = 'consumer_secret'
access_token = 'access_token'
access_token_secret = 'access_token_secret'


# Twitter requires 0Auth2 authentication. You can readup about this.
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)


def retweet_bot():
for tweet in tweepy.Cursor(api.search, q='Hashtag to listen for').items(10):
try:
print('Twitter user: ' + '@' + tweet.user.screen_name)
tweet.retweet()
print('\nDone')
time.sleep(5) # You can remove the time module, if you want the program to continuously retweet
except tweepy.error.TweepError:
pass


if __name__ == '__main__':
retweet_bot()