]> jfr.im git - z_archive/twitter.git/blobdiff - twitter/cmdline.py
Oops, left debugging cruft on there.
[z_archive/twitter.git] / twitter / cmdline.py
index 102ac5654fde9dbc2299cc0c8efe11b43eba8e7b..120d629b11eb1e1e6719defa49b5407e5af69d89 100644 (file)
@@ -65,7 +65,7 @@ prompt: <twitter_shell_prompt e.g. '[cyan]twitter[R]> '>
 from __future__ import print_function
 
 try:
-    input = __builtins__['raw_input']
+    input = __builtins__.raw_input
 except (AttributeError, KeyError):
     pass
 
@@ -73,14 +73,15 @@ except (AttributeError, KeyError):
 CONSUMER_KEY = 'uS6hO2sV6tDKIOeVjhnFnQ'
 CONSUMER_SECRET = 'MEYTOS97VvlHX7K1rwHPEqVpTSqZ71HtvoK4sVuYk'
 
-import sys
-import time
 from getopt import gnu_getopt as getopt, GetoptError
 from getpass import getpass
-import re
-import os.path
+import json
 import locale
+import os.path
+import re
 import string
+import sys
+import time
 
 try:
     from ConfigParser import SafeConfigParser
@@ -216,7 +217,7 @@ class AnsiStatusFormatter(object):
 
     def __call__(self, status, options):
         colour = self._colourMap.colourFor(status['user']['screen_name'])
-        return ("%s%s%s%s %s" % (
+        return ("%s%s% 16s%s %s" %(
             get_time_string(status, options),
             ansiFormatter.cmdColour(colour), status['user']['screen_name'],
             ansiFormatter.cmdReset(), replaceInStatus(status['text'])))
@@ -368,7 +369,7 @@ class Action(object):
 
     def ask(self, subject='perform this action', careful=False):
         '''
-        Requests fromhe user using `raw_input` if `subject` should be
+        Requests from the user using `raw_input` if `subject` should be
         performed. When `careful`, the default answer is NO, otherwise YES.
         Returns the user answer in the form `True` or `False`.
         '''
@@ -499,11 +500,11 @@ class RepliesAction(StatusAction):
 
 class FollowAction(AdminAction):
     def getUser(self, twitter, user):
-        return twitter.friendships.create(id=user)
+        return twitter.friendships.create(screen_name=user)
 
 class LeaveAction(AdminAction):
     def getUser(self, twitter, user):
-        return twitter.friendships.destroy(id=user)
+        return twitter.friendships.destroy(screen_name=user)
 
 class SetStatusAction(Action):
     def __call__(self, twitter, options):
@@ -605,7 +606,7 @@ class DoNothingAction(Action):
 
 class RateLimitStatus(Action):
     def __call__(self, twitter, options):
-        rate = twitter.account.rate_limit_status()
+        rate = twitter.application.rate_limit_status()
         print("Remaining API requests: %s / %s (hourly limit)" % (rate['remaining_hits'], rate['hourly_limit']))
         print("Next reset in %ss (%s)" % (int(rate['reset_time_in_seconds'] - time.time()),
                                           time.asctime(time.localtime(rate['reset_time_in_seconds']))))