-
Notifications
You must be signed in to change notification settings - Fork 323
/
Copy pathtwitter-post-status.py
executable file
·36 lines (29 loc) · 1.38 KB
/
twitter-post-status.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env python3
#-----------------------------------------------------------------------
# twitter-post-status
# - posts a status message to your timeline
#-----------------------------------------------------------------------
from twitter import *
#-----------------------------------------------------------------------
# what should our new status be?
#-----------------------------------------------------------------------
new_status = "testing testing"
#-----------------------------------------------------------------------
# load our API credentials
#-----------------------------------------------------------------------
import sys
sys.path.append(".")
import config
#-----------------------------------------------------------------------
# create twitter API object
#-----------------------------------------------------------------------
twitter = Twitter(auth=OAuth(config.access_key,
config.access_secret,
config.consumer_key,
config.consumer_secret))
#-----------------------------------------------------------------------
# post a new status
# twitter API docs: https://dev.twitter.com/rest/reference/post/statuses/update
#-----------------------------------------------------------------------
results = twitter.statuses.update(status=new_status)
print("updated status: %s" % new_status)