How to tweet via Python script?

tweet with python script

What do you need to install?

Steps

import tweepy# Consumer keys and access tokens from twitter developer console
CONSUMER_SECRET = ‘############’
CONSUMER_KEY = ‘############’
ACCESS_SECRET = ‘#############’
ACCESS_KEY = ‘##############’
# OAuth authentication connection from
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth.set_access_token(ACCESS_KEY, ACCESS_SECRET)
# Creation of the actual interface, using authentication
tweet = tweepy.API(auth)
# Write tweet here
tweet.update_status(“Hi from API” )