Skip to content

Instantly share code, notes, and snippets.

Created Mar 3, 2015
What would you like to do?
An example of a basic Python TwitterBot using the Tweepy package
import tweepy
class TwitterAPI:
def __init__(self):
consumer_key = ""
consumer_secret = ""
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
access_token = ""
access_token_secret = ""
auth.set_access_token(access_token, access_token_secret)
self.api = tweepy.API(auth)
def tweet(self, message):
if __name__ == "__main__":
twitter = TwitterAPI()
twitter.tweet("I'm posting a tweet!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment