Fixed length checking in updateStatus(), removed debug lines from searchTwitter()
This commit is contained in:
parent
d974321854
commit
102eac4d6e
1 changed files with 2 additions and 1 deletions
3
tango.py
3
tango.py
|
|
@ -148,6 +148,8 @@ class setup:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def updateStatus(self, status, in_reply_to_status_id = None):
|
def updateStatus(self, status, in_reply_to_status_id = None):
|
||||||
|
if len(list(status)) > 140:
|
||||||
|
print "This status message is over 140 characters, but we're gonna try it anyway. Might wanna watch this!"
|
||||||
if self.authenticated is True:
|
if self.authenticated is True:
|
||||||
try:
|
try:
|
||||||
return simplejson.load(self.opener.open("http://twitter.com/statuses/update.json?", urllib.urlencode({"status": status}, {"in_reply_to_status_id": in_reply_to_status_id})))
|
return simplejson.load(self.opener.open("http://twitter.com/statuses/update.json?", urllib.urlencode({"status": status}, {"in_reply_to_status_id": in_reply_to_status_id})))
|
||||||
|
|
@ -536,7 +538,6 @@ class setup:
|
||||||
def searchTwitter(self, search_query, **kwargs):
|
def searchTwitter(self, search_query, **kwargs):
|
||||||
baseURL = "http://search.twitter.com/search.json?" + urllib.urlencode({"q": search_query})
|
baseURL = "http://search.twitter.com/search.json?" + urllib.urlencode({"q": search_query})
|
||||||
searchURL = self.constructApiURL(baseURL, kwargs, questionMarkUsed=True)
|
searchURL = self.constructApiURL(baseURL, kwargs, questionMarkUsed=True)
|
||||||
print searchURL
|
|
||||||
try:
|
try:
|
||||||
return simplejson.load(urllib2.urlopen(searchURL))
|
return simplejson.load(urllib2.urlopen(searchURL))
|
||||||
except HTTPError, e:
|
except HTTPError, e:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue