Created
January 28, 2018 09:21
-
-
Save hmharshit/1c21b3a3cbe1a57f192a7b08b4411031 to your computer and use it in GitHub Desktop.
It posts motivational quotes on twitter. Update the credentials in the file and install requirements.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""This script tweets random motivational quotes on your twitter account""" | |
import requests | |
import datetime | |
import tweepy | |
# Update the credentials of your a/c. Refer here to make app https://apps.twitter.com | |
CONSUMER_KEY = '' | |
CONSUMER_SECRET = '' | |
ACCESS_TOKEN = '' | |
ACCESS_TOKEN_SECRET = '' | |
API = 'https://talaikis.com/api/quotes/random/' | |
curr_day = datetime.datetime.now().weekday() | |
day = ['MondayMotivation', 'TuesdayThoughts', 'WednesdayWisdom', 'ThursdayMotivation', | |
'FridayFeeling', 'SaturdayThinking', 'SundayMorning'] # Trending hashtags | |
response = requests.get(api).json() | |
quote = response.get('quote') + '\n#{}'.format(day[curr_day]) | |
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET) | |
auth.set_access_token(ACCESS_TOKEN, ACCESS_TOKEN_SECRET) | |
api = tweepy.API(auth) | |
api.update_status(status=quote) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment