Skip to content

Instantly share code, notes, and snippets.

@dogukancagatay
Created June 10, 2020 06:16
Show Gist options
  • Save dogukancagatay/df305c8aadb6d906b12cd9f58d48eb8a to your computer and use it in GitHub Desktop.
Save dogukancagatay/df305c8aadb6d906b12cd9f58d48eb8a to your computer and use it in GitHub Desktop.
Tweepy Twitter API
import tweepy
consumer_key = ""
consumer_secret = ""
access_token = ""
access_token_secret = ""
try:
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
# for tweet in tweepy.Cursor(api.search, q='tweepy').items(10):
# print(tweet.text)
for tweet in tweepy.Cursor(api.user_timeline, id='twitter').items(10):
print(tweet.text)
except tweepy.TweepError as e:
print("Error!")
print(e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment