forked from ideoforms/python-twitter-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
twitter-post-status.py
executable file
·32 lines (26 loc) · 1.3 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
#!/usr/bin/python
#-----------------------------------------------------------------------
# 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
#-----------------------------------------------------------------------
config = {}
execfile("config.py", 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/docs/api/1/post/statuses/update
#-----------------------------------------------------------------------
results = twitter.statuses.update(status = new_status)
print "updated status: %s" % new_status