JGuizard
6/27/2016 - 8:33 AM

Access Twitter API in Python with Tweepy

Access Twitter API in Python with Tweepy

#https://github.com/tweepy/tweepy

#Initialization

import tweepy

CONSUMER_KEY = "1it2U7waBtWLZmGiDkb1vX6JV"
CONSUMER_SECRET = "2pJS7Ln4SrZWwQardSIOnyqys8HZO1HpetrBlEN31zUX0z7Yg9"

ACCESS_TOKEN = "3293500504-Ivq4DUvk5SypgDE4qaQtfz6GxnRASmq8wK6wuXY"
TOKEN_SECRET = "s2Y4tDldF47p0iAvNbxSjqHuovGKyhgAJpMfQmFLdQ2zE"

auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth.set_access_token(ACCESS_TOKEN, TOKEN_SECRET)

api = tweepy.API(auth)

#Print timeline

public_tweets = api.home_timeline()
for tweet in public_tweets:
    print tweet.text