Last active
September 25, 2016 17:58
-
-
Save nonchip/a115dbc7353b7eac83497158d1f0b2af to your computer and use it in GitHub Desktop.
Python_stuff
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 tweepy | |
f=open(".keys","r") | |
consumer_key=f.readline().rstrip().split()[0] | |
consumer_secret=f.readline().rstrip().split()[0] | |
access_token=f.readline().rstrip().split()[0] | |
access_token_secret=f.readline().rstrip().split()[0] | |
f.close() | |
auth = tweepy.OAuthHandler(consumer_key,consumer_secret) | |
if access_token == "": | |
print(auth.get_authorization_url()) | |
print("now go to the url and paste the generated key back here.") | |
auth.get_access_token(input()) | |
f=open(".keys","a") | |
f.write(auth.access_token+"\n") | |
f.write(auth.access_token_secret+"\n") | |
f.close() | |
else: | |
auth.set_access_token(access_token, access_token_secret) | |
api = tweepy.API(auth) | |
public_tweets = api.home_timeline() | |
for tweet in public_tweets: | |
print tweet.text |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment