Skip to content

Instantly share code, notes, and snippets.

@sagunsh
Last active March 31, 2020 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sagunsh/da38b6fc048d5121851f831d176e4649 to your computer and use it in GitHub Desktop.
Save sagunsh/da38b6fc048d5121851f831d176e4649 to your computer and use it in GitHub Desktop.
import sys
import tweepy
from config import CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET
if __name__ == '__main__':
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth.set_access_token(ACCESS_TOKEN, ACCESS_TOKEN_SECRET)
# Create API object
api = tweepy.API(auth)
try:
api.verify_credentials()
print('Authentication Successful')
except:
print('Error while authenticating API')
sys.exit(1)
api.update_status('First tweet from my bot') # tweet from your account
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment