- Create the lambda function with daily trigger
- goto https://apps.twitter.com/
- Create a new app
- In keys and access tokens for the new app click "create access token"
- Fill in the values here
Last active
February 5, 2017 05:56
-
-
Save ranman/ab5adddbe3b8210ef968eb859afbbc8a to your computer and use it in GitHub Desktop.
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 requests | |
from requests_oauthlib import OAuth1 | |
auth = OAuth1( | |
'consumer', | |
'consumer_secret', | |
'auth', | |
'auth_secret' | |
) | |
reinvent = datetime.date(2016, 11, 28) | |
today = datetime.date.today() | |
diff = reinvent - today | |
status = """\ | |
Only {} days until @AWSreInvent #RoadToReInvent!! https://reinvent.awsevents.com/ | |
""".format(diff.days) | |
def lambda_handler(event, context): | |
resp = requests.post( | |
"https://api.twitter.com/1.1/statuses/update.json", | |
data={'status': status}, | |
auth=auth | |
) | |
resp.raise_for_status() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment