Twitter Bot with Python

twitter_logoPretty easy really:

    1. Create your twitter account for your bot.
    2. Go to dev.twitter.com
    3. Register your app
    4. Gain your app keys
    5. In your Python script “import tweepy” (you may need to pip install tweepy first).
    6. Add a function to perform the tweet
    7.  
       

      def tweet(message):
      #enter the corresponding information from your Twitter application:
      CONSUMER_KEY = "" #keep the quotes, replace this with your consumer key
      CONSUMER_SECRET = "" #keep the quotes, replace this with your consumer secret key
      ACCESS_KEY = "" #keep the quotes, replace this with your access token
      ACCESS_SECRET = "" #keep the quotes, replace this with your access token secret
      auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
      auth.set_access_token(ACCESS_KEY, ACCESS_SECRET)
      api = tweepy.API(auth)
      api.update_status(message)

    8. Simply then call your function passing in the message you wish to Tweet.

    Kudos to http://www.dototot.com/how-to-write-a-twitter-bot-with-python-and-tweepy/

    Leave a Reply

%d bloggers like this: