Fixing a bug with authentication in showStatus() - previously it assumed that you were *always* authenticated

This commit is contained in:
Ryan McGrath 2009-07-29 00:08:26 -04:00
parent 6fe1a95a2e
commit c83a033765
2 changed files with 8 additions and 2 deletions

View file

@ -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)

View file

@ -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)