Fixing a bug with authentication in showStatus() - previously it assumed that you were *always* authenticated
This commit is contained in:
parent
6fe1a95a2e
commit
c83a033765
2 changed files with 8 additions and 2 deletions
|
|
@ -151,7 +151,10 @@ class setup:
|
||||||
|
|
||||||
def showStatus(self, id):
|
def showStatus(self, id):
|
||||||
try:
|
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:
|
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."
|
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)
|
% `e.code`, e.code)
|
||||||
|
|
|
||||||
|
|
@ -151,7 +151,10 @@ class setup:
|
||||||
|
|
||||||
def showStatus(self, id):
|
def showStatus(self, id):
|
||||||
try:
|
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:
|
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."
|
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)
|
% repr(e.code), e.code)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue