-
-
Save anonymous/228a37baed04cf71594e0bb51a34aa21 to your computer and use it in GitHub Desktop.
days until election
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
import datetime | |
import webapp2 | |
import time | |
import sys | |
import twython | |
from twython import Twython, TwythonError | |
class DaysUntil(webapp2.RequestHandler): | |
def get(self) | |
CONSUMER_KEY = ‘???’ | |
CONSUMER_SECRET = ‘???’ | |
ACCESS_KEY = ‘???’ | |
ACCESS_SECRET = ‘???’ | |
from datetime import * | |
today = date.today() | |
future = date(2018,11,5) | |
diff = future - today | |
NUMBER = diff.days | |
twitter = twython.Twython( | |
CONSUMER_KEY, | |
CONSUMER_SECRET, | |
ACCESS_KEY, | |
ACCESS_SECRET | |
) | |
photo = open("%s.jpg" %NUMBER,'rb') | |
response = twitter.upload_media(media=photo) | |
twitter.update_status(status="%s days until the United States Midterm Elections on November 6th, 2018. #election2018 #campaign2018 #politics" %NUMBER, media_ids=[response['media_id']]) | |
app = webapp2.WSGIApplication(['/', DaysUntill]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment