· 7 years ago · Sep 09, 2018, 09:54 PM
1# you need to 'pip install path.py'
2from path import path
3from twitter import *
4
5APP_NAME='YOURS'
6CONSUMER_KEY='YOURS'
7CONSUMER_SECRET='YOURS'
8
9# uses a file @ cwd+.creds
10CREDS_FILE = path.joinpath(path.getcwd(), path('.creds'))
11
12if not path.isfile(CREDS_FILE):
13 oauth_dance(APP_NAME, CONSUMER_KEY, CONSUMER_SECRET,
14 CREDS_FILE)
15
16oauth_token, oauth_secret = read_token_file(CREDS_FILE)
17
18t = Twitter(
19 auth=OAuth(
20 oauth_token, oauth_secret, CONSUMER_KEY, CONSUMER_SECRET
21 )
22 )
23
24# beware! this will post an update
25t.statuses.update(status='Test Update from Python')