Last active
January 4, 2022 00:03
-
-
Save alexsc6955/7a33e4ff4c6b009a82560e9b11f125b1 to your computer and use it in GitHub Desktop.
Tweet using tweepy
This file contains hidden or 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 | |
# You can get this credentials from your tweeter developer account | |
consumer_key = 'xxxxxxxxxxxxxxxxx' | |
consumer_secret = 'xxxxxxxxxxxxxxxxxxx' | |
key = 'xxxxxxxxxxxxxx-xxxxxxxxxxxxx' | |
secret = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' | |
auth = tweepy.OAuthHandler(consumer_key, consumer_secret) | |
try: | |
auth.set_access_token(key, secrey) | |
API = tweepy.API(auth, wait_on_rate_limit=True) | |
tweet = API.update_status('My tweet using #tweepy") | |
print(tweet.text) | |
except tweepy.errors.TweepyException as e: | |
print('Error! Failed to get access token.') | |
print(e) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment