]> jfr.im git - z_archive/twitter.git/commitdiff
Heading for 0.4.1. Use stdlib json module if available, remove a 2.6 deprecation.
authormverdone <redacted>
Fri, 3 Oct 2008 17:48:51 +0000 (17:48 +0000)
committermverdone <redacted>
Fri, 3 Oct 2008 17:48:51 +0000 (17:48 +0000)
git-svn-id: http://svn.mike.verdone.ca/pyprojects/twitter/trunk@181 d723f978-dc38-0410-87ed-da353333cdcc

README
setup.py
twitter/api.py
twitter/cmdline.py

diff --git a/README b/README
index 556f1886a032d923f57dfe6de948a6976960ee0f..812656afb16f3e35a8fd3a7a9df9182c81838ba0 100644 (file)
--- a/README
+++ b/README
@@ -1,8 +1,13 @@
 Python Twitter Tools
 
-The Minimalist Twitter API for Python is a Python API for Twitter, everyone's favorite Web 2.0 Facebook-style status updater for people on the go.
+The Minimalist Twitter API for Python is a Python API for Twitter,
+everyone's favorite Web 2.0 Facebook-style status updater for people
+on the go.
 
-Also included is a twitter command-line tool for getting your friends' tweets and setting your own tweet from the safety and security of your favorite shell and an IRC bot that can announce Twitter updated to an IRC channel.
+Also included is a twitter command-line tool for getting your friends'
+tweets and setting your own tweet from the safety and security of your
+favorite shell and an IRC bot that can announce Twitter updated to an
+IRC channel.
 
 For more information:
 
index 9a61d640c6aa8c53dfde65d1ebc91e1f5af34fef..0e08d6cf96b1ff8f9cc2d5e20ac2da4de8230cc4 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -1,7 +1,7 @@
 from setuptools import setup, find_packages
 import sys, os
 
-version = '0.4'
+version = '0.4.1'
 
 setup(name='twitter',
       version=version,
index c59d121f4377c5381e71ccea9ff50eeaebcb599d..41dd277a4ec3efd707d95dcd2826226a1739ba75 100644 (file)
@@ -6,6 +6,15 @@ import httplib
 
 from exceptions import Exception
 
+def _py26OrGreater():
+    import sys
+    return sys.hexversion > 0x20600f0
+
+if _py26OrGreater():
+    import json
+else:
+    import simplejson as json
+
 class TwitterError(Exception):
     """
     Exception thrown by the Twitter object when there is an
@@ -54,8 +63,7 @@ class TwitterCall(object):
                 raise TwitterError("Twitter sent status %i: %s" %(
                     r.status, r.read()))
             if ("json" == self.format):
-                import simplejson
-                return simplejson.loads(r.read())
+                return json.loads(r.read())
             else:
                 return r.read()
         finally:
@@ -120,12 +128,6 @@ class Twitter(TwitterCall):
         """
         if (format not in ("json", "xml")):
             raise TwitterError("Unknown data format '%s'" %(format))
-        if (format == "json"):
-            try:
-                import simplejson
-            except ImportError:
-                raise TwitterError(
-                    "format not available: simplejson is not installed")
         TwitterCall.__init__(self, email, password, format)
 
 __all__ = ["Twitter"]
index fcf2f6b9d064e05914c7145350f21bb0c90e642a..c605e219a5ac39ae43f44838da1fe86716934c95 100644 (file)
@@ -191,7 +191,7 @@ def main_with_args(args):
         else:
             doAction()
     except TwitterError, e:
-        print >> sys.stderr, e.message
+        print >> sys.stderr, e.args[0]
         print >> sys.stderr, "Use 'twitter -h' for help."
         sys.exit(1)
     except KeyboardInterrupt: