24
loading...
This website collects cookies to deliver better user experience
pip install tweepy
The consumer key and the consumer secret were created at the beginning of the tutorial: they will allow your script to be authenticated by the platform.
The access token and access token secret were created in a second step after we changed the app's permissions: they will allow your script to tweet on behalf of your main account.
import tweepy
consumer_key = 'XXXXXXXXXX'
consumer_secret = 'XXXXXXXXXX'
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
access_token = 'XXXXXXXXXX'
access_token_secret = 'XXXXXXXXXX'
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
res = api.update_status('Hello World!')