Skip to content

Instantly share code, notes, and snippets.

@Lawrence-Liu
Lawrence-Liu / Twitter_OAuth.py
Created September 12, 2015 02:53
an example of getting access credentials for a user
import tweepy
#load consumer credentials
with open('/Users/lawrence/Documents/twitter_bot/keys.pass', 'r') as keys:
CONSUMER_KEY = keys.readline().split(':')[1].strip('\n')
CONSUMER_SECRET = keys.readline().split(':')[1].strip('\n')
#create an OAuth handler
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
#get redirected url
try: