· 7 years ago · Jun 13, 2018, 03:24 PM
1#! /usr/bin/env python
2# coding:utf-8
3
4import twitter_oauth
5
6# write your oauth token and oauth token secret
7consumer_key = 'cBqPWLkLtTRM2wbCqH9rIw'
8consumer_secret = 'mnHm5WBv7ZAOlxKga16dRoouTA2Df9HJmtSO1H0'
9
10# create GetOauth instance
11get_oauth_obj = twitter_oauth.GetOauth(consumer_key, consumer_secret)
12
13# get oauth_token and oauth token secret
14key_dict = get_oauth_obj.get_oauth()
15
16# create Api instance
17api = twitter_oauth.Api(consumer_key, consumer_secret, key_dict['oauth_token'],
18key_dict['oauth_token_secret'])
19
20# post update
21api.post_update(u'Yeah')