From c83a033765e53ebf3a93b8c8d395831304cd545e Mon Sep 17 00:00:00 2001 From: Ryan McGrath Date: Wed, 29 Jul 2009 00:08:26 -0400 Subject: [PATCH] Fixing a bug with authentication in showStatus() - previously it assumed that you were *always* authenticated --- tango/tango.py | 5 ++++- tango/tango3k.py | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/tango/tango.py b/tango/tango.py index 0b7d734..87d1098 100644 --- a/tango/tango.py +++ b/tango/tango.py @@ -151,7 +151,10 @@ class setup: def showStatus(self, id): try: - return simplejson.load(self.opener.open("http://twitter.com/statuses/show/%s.json" % id)) + if self.authenticated is True: + return simplejson.load(self.opener.open("http://twitter.com/statuses/show/%s.json" % id)) + else: + return simplejson.load(urllib2.urlopen("http://twitter.com/statuses/show/%s.json" % id)) except HTTPError, e: raise TangoError("Failed with a %s error code. Does this user hide/protect their updates? You'll need to authenticate and be friends to get their timeline." % `e.code`, e.code) diff --git a/tango/tango3k.py b/tango/tango3k.py index e3149be..201b3e6 100644 --- a/tango/tango3k.py +++ b/tango/tango3k.py @@ -151,7 +151,10 @@ class setup: def showStatus(self, id): try: - return simplejson.load(self.opener.open("http://twitter.com/statuses/show/%s.json" % id)) + if self.authenticated is True: + return simplejson.load(self.opener.open("http://twitter.com/statuses/show/%s.json" % id)) + else: + return simplejson.load(urllib.request.urlopen("http://twitter.com/statuses/show/%s.json" % id)) except HTTPError as e: raise TangoError("Failed with a %s error code. Does this user hide/protect their updates? You'll need to authenticate and be friends to get their timeline." % repr(e.code), e.code)