Last active
March 31, 2020 14:08
-
-
Save sagunsh/da38b6fc048d5121851f831d176e4649 to your computer and use it in GitHub Desktop.
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 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