Last active
November 3, 2019 15:46
-
-
Save deploytoprod/67197d3ac4e4819bbe4e5d42c8331990 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
from requests_oauthlib import OAuth1Session | |
import urllib | |
CONSUMER_KEY = 'AAA' | |
CONSUMER_SECRET = 'BBB' | |
ACCESS_TOKEN = 'CCC' | |
ACCESS_SECRET = 'DDD' | |
# Above I put credentials for the App 'TwitterBoxRaf', App ID '16265219' | |
twitter = OAuth1Session(CONSUMER_KEY, | |
client_secret=CONSUMER_SECRET, | |
resource_owner_key=ACCESS_TOKEN, | |
resource_owner_secret=ACCESS_SECRET) | |
webhook_endpoint = urllib.parse.quote_plus('My AWS API Gateway endpoint here') | |
url = 'https://api.twitter.com/1.1/account_activity/all/prod/webhooks.json?url={}'.format(webhook_endpoint) | |
r = twitter.post(url) | |
# In Twitter web settings, the app 'TwitterBoxRaf' is associated with the env called 'prod' | |
r = twitter.post(url) | |
print(r.json()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment