public
Description: A twisted client for twitter-like APIs.
Homepage:
Clone URL: git://github.com/dustin/twitty-twister.git
twitty-twister / example / update-oauth.py
100755 30 lines (20 sloc) 0.619 kb
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
#!/usr/bin/env python
"""
Copyright (c) 2009 Kevin Dunglas <dunglas@gmail.com>
"""
 
import os
import sys
 
sys.path.append(os.path.join(sys.path[0], '..', 'twittytwister'))
sys.path.append('twittytwister')
 
from twisted.internet import reactor
 
import twitter
from oauth import oauth
 
def cb(x):
    print "Posted id", x
 
def eb(e):
    print e
 
consumer = oauth.OAuthConsumer(sys.argv[1], sys.argv[2])
token = oauth.OAuthToken(sys.argv[3], sys.argv[4])
 
twitter.Twitter(consumer=consumer, token=token).update(' '.join(sys.argv[5:])
    ).addCallback(cb).addErrback(eb).addBoth(lambda x: reactor.stop())
 
reactor.run()