Added a method to check against the public timeline
This commit is contained in:
parent
f93d02dfb9
commit
1f544c6aaf
1 changed files with 16 additions and 0 deletions
16
tango.py
16
tango.py
|
|
@ -30,6 +30,13 @@ class setup:
|
||||||
questionMarkUsed = True
|
questionMarkUsed = True
|
||||||
return queryURL
|
return queryURL
|
||||||
|
|
||||||
|
def getPublicTimeline(self):
|
||||||
|
publicTimeline = simplejson.load(urllib2.urlopen("http://twitter.com/statuses/public_timeline.json"))
|
||||||
|
formattedTimeline = []
|
||||||
|
for tweet in publicTimeline:
|
||||||
|
formattedTimeline.append(tweet['text'])
|
||||||
|
return formattedTimeline
|
||||||
|
|
||||||
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
|
||||||
# By doing this with kwargs and constructing a url outside, we can stay somewhat agnostic of API changes - it's all
|
# By doing this with kwargs and constructing a url outside, we can stay somewhat agnostic of API changes - it's all
|
||||||
|
|
@ -40,7 +47,16 @@ class setup:
|
||||||
for tweet in userTimeline:
|
for tweet in userTimeline:
|
||||||
formattedTimeline.append(tweet['text'])
|
formattedTimeline.append(tweet['text'])
|
||||||
return formattedTimeline
|
return formattedTimeline
|
||||||
|
|
||||||
|
def getUserMentions(self, **kwargs):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def updateStatus(self, **kwargs):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def destroyStatus(self, **kwargs):
|
||||||
|
pass
|
||||||
|
|
||||||
def getSearchTimeline(self, search_query, optional_page):
|
def getSearchTimeline(self, search_query, optional_page):
|
||||||
params = urllib.urlencode({'q': search_query, 'rpp': optional_page}) # Doesn't hurt to do pages this way. *shrug*
|
params = urllib.urlencode({'q': search_query, 'rpp': optional_page}) # Doesn't hurt to do pages this way. *shrug*
|
||||||
searchTimeline = simplejson.load(urllib2.urlopen("http://search.twitter.com/search.json", params))
|
searchTimeline = simplejson.load(urllib2.urlopen("http://search.twitter.com/search.json", params))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue