Skip to content

Instantly share code, notes, and snippets.

Created May 30, 2016 11:25
What would you like to do?
# codin: utf-8
import tweepy
import csv
def oauth():
consumer_key = "consumer_key"
consumer_secret = "consumer_secret"
access_key = "access_key"
access_secret = "access_secret"
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_key, access_secret)
return auth
if __name__ == "__main__":
api = tweepy.API(oauth())
with open("tweet.csv", "a") as f:
writer = csv.writer(f, lineterminator="\n")
for status in tweepy.Cursor(api.user_timeline).items():
writer.writerow([status.text.encode('utf-8'), status.created_at])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment