leave remove the specified user from your following list
public get latest public tweets
replies get latest replies
- search searchtwitter (Beware: octothorpe, escape it)
+ search search twitter (Beware: octothorpe, escape it)
set set your twitter status
shell login the twitter shell
-t --timestamp show time before status lines
-d --datestamp shoe date before status lines
--no-ssl use HTTP instead of more secure HTTPS
-
+ --oauth <filename> filename to read/store oauth credentials to
FORMATS for the --format option
OAuth authentication tokens are stored in the file .twitter_oauth in your
home directory.
-
"""
CONSUMER_KEY='uS6hO2sV6tDKIOeVjhnFnQ'
from oauth import OAuth
import ansi
-# Please don't change this, it was provided by the fine folks at Twitter.
-# If you change it, it will not work.
-AGENT_STR = "twittercommandlinetoolpy"
-
OPTIONS = {
'action': 'friends',
'refresh': False,
}
def parse_args(args, options):
- long_opts = ['help', 'format', 'refresh',
- 'refresh-rate', 'config', 'length', 'timestamp',
+ long_opts = ['help', 'format=', 'refresh', 'oauth=',
+ 'refresh-rate=', 'config=', 'length=', 'timestamp',
'datestamp', 'no-ssl']
short_opts = "e:p:f:h?rR:c:l:td"
opts, extra_args = getopt(args, short_opts, long_opts)
options['config_filename'] = arg
elif opt == '--no-ssl':
options['secure'] = False
+ elif opt == '--oauth':
+ options['oauth_filename'] = arg
if extra_args and not ('action' in options and options['action'] == 'help'):
options['action'] = extra_args[0]
# We need to be pointing at search.twitter.com to work, and it is less
# tangly to do it here than in the main()
twitter.domain="search.twitter.com"
+ twitter.uri=""
# We need to bypass the TwitterCall parameter encoding, so we
# don't encode the plus sign, so we have to encode it ourselves
query_string = "+".join([quote(term) for term in options['extra_args']])
webbrowser.open(
'http://api.twitter.com/oauth/authorize?oauth_token=' +
oauth_token)
+ time.sleep(2) # Sometimes the last command can print some
+ # crap. Wait a bit so it doesn't mess up the next
+ # prompt.
oauth_verifier = raw_input("Please type the PIN: ").strip()
twitter = Twitter(
auth=OAuth(
print >> oauth_file, oauth_token
print >> oauth_file, oauth_token_secret
oauth_file.close()
+ print
print "That's it! Your authorization keys have been written to %s." % (
options['oauth_filename'])
twitter = Twitter(
auth=OAuth(
oauth_token, oauth_token_secret, CONSUMER_KEY, CONSUMER_SECRET),
- secure=options['secure'])
+ secure=options['secure'],
+ api_version='1')
try:
Action()(twitter, options)