Using Tweepy with Python
by
Nick Rimmer
import datetime
import tweepy
consumer_key = ''
consumer_secret = ''
access_token = ''
access_token_secret = ''
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
def publictweet():
if datetime.date.today().weekday() == 0:
tweettopublish = 'Hi everyone, today is Monday. #Monday '
if datetime.date.today().weekday() == 1:
tweettopublish = 'Enjoy your Tuesday. #Tuesday'
if datetime.date.today().weekday() == 2:
tweettopublish = 'Third day of the Week. #Wednesday'
if datetime.date.today().weekday() == 3:
tweettopublish = 'Thursday. Another BOT'
if datetime.date.today().weekday() == 4:
tweettopublish = 'Friday...Finally'
if datetime.date.today().weekday() == 5:
tweettopublish = 'Great it is Saturday #weekend #Saturday'
if datetime.date.today().weekday() == 6:
tweettopublish = 'Sunday morning...#Weekend #enjoy '
api.update_status(tweettopublish)
print(tweettopublish)