Created
November 29, 2018 15:43
-
-
Save johnmanjiro13/2a3f114d0d5ef887fd3c7075a29ce4ba to your computer and use it in GitHub Desktop.
oauth with tweepy
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 os | |
import tweepy | |
def create_twitter_api(): | |
consumer_key = os.getenv('TWITTER_API_KEY') | |
consumer_secret = os.getenv('TWITTER_API_SECRET') | |
access_token = os.getenv('TWITTER_ACCESS_TOKEN') | |
access_secret = os.getenv('TWITTER_ACCESS_TOKEN_SECRET') | |
auth = tweepy.OAuthHandler(consumer_key, consumer_secret) | |
auth.set_access_token(access_token, access_secret) | |
api = tweepy.API(auth) | |
return api |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment