Worked in some try/catch support for loading and hitting the API - needs to happen for other functions as well, once I have more time.
This commit is contained in:
parent
1f544c6aaf
commit
c47d6008a0
1 changed files with 11 additions and 5 deletions
16
tango.py
16
tango.py
|
|
@ -31,11 +31,17 @@ class setup:
|
||||||
return queryURL
|
return queryURL
|
||||||
|
|
||||||
def getPublicTimeline(self):
|
def getPublicTimeline(self):
|
||||||
publicTimeline = simplejson.load(urllib2.urlopen("http://twitter.com/statuses/public_timeline.json"))
|
try:
|
||||||
formattedTimeline = []
|
publicTimeline = simplejson.load(urllib2.urlopen("http://twitter.com/statuses/public_timeline.json"))
|
||||||
for tweet in publicTimeline:
|
formattedTimeline = []
|
||||||
formattedTimeline.append(tweet['text'])
|
for tweet in publicTimeline:
|
||||||
return formattedTimeline
|
formattedTimeline.append(tweet['text'])
|
||||||
|
return formattedTimeline
|
||||||
|
except IOError, e:
|
||||||
|
if hasattr(e, 'code'):
|
||||||
|
return "Loading API failed with HTTP Status Code " + e.code
|
||||||
|
else:
|
||||||
|
return "God help us all, Scotty, she's dead and we're not sure why."
|
||||||
|
|
||||||
def getUserTimeline(self, **kwargs):
|
def getUserTimeline(self, **kwargs):
|
||||||
# 99% API compliant, I think - need to figure out Gzip compression and auto-getting based on authentication
|
# 99% API compliant, I think - need to figure out Gzip compression and auto-getting based on authentication
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue