Created
June 10, 2020 06:16
-
-
Save dogukancagatay/df305c8aadb6d906b12cd9f58d48eb8a to your computer and use it in GitHub Desktop.
Tweepy Twitter API
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 | |
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