forked from migurski/dwim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcanijust.py
33 lines (24 loc) · 1.13 KB
/
canijust.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
from sys import stderr, exit
from optparse import OptionParser
from dwim import oauthdance
parser = OptionParser(usage="""%prog [options] <consumer key> <consumer secret>""")
defaults = {
'request_token_url': 'http://twitter.com/oauth/request_token',
'authorize_url': 'http://twitter.com/oauth/authorize',
'access_token_url': 'http://twitter.com/oauth/access_token'
}
parser.set_defaults(**defaults)
parser.add_option('-r', '--request-token-url', dest='request_token_url',
help='Default: %s' % defaults['request_token_url'])
parser.add_option('-a', '--authorize-url', dest='authorize_url',
help='Default: %s' % defaults['authorize_url'])
parser.add_option('-t', '--access-token-url', dest='access_token_url',
help='Default: %s' % defaults['access_token_url'])
if __name__ == '__main__':
options, args = parser.parse_args()
try:
key, secret = args
except ValueError:
print >> stderr, 'Need a key and secret, got: ' + repr(args)
exit(1)
oauthdance(key, secret, options.request_token_url, options.authorize_url, options.access_token_url)