Skip to content

Instantly share code, notes, and snippets.

@alexsc6955
Last active January 4, 2022 00:03
Show Gist options
  • Save alexsc6955/7a33e4ff4c6b009a82560e9b11f125b1 to your computer and use it in GitHub Desktop.
Save alexsc6955/7a33e4ff4c6b009a82560e9b11f125b1 to your computer and use it in GitHub Desktop.
Tweet using tweepy
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