danielpronych / python-twitter

Automatically exported from code.google.com/p/python-twitter
Apache License 2.0
0 stars 0 forks source link

GetSearch to support geocode query without term #159

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
According to the twitter search api, your allowed to omit the term (variable 
'q') if you are using a geocode, but the GetSearch function doesn't support 
omitting the term. 

Minor tweaks fix this, bellow is the output of hg diff:

diff --git a/twitter.py b/twitter.py
--- a/twitter.py
+++ b/twitter.py
@@ -1857,7 +1857,7 @@
     return results

   def GetSearch(self,
-                term,
+                term=None,
                 geocode=None,
                 since_id=None,
                 per_page=15,
@@ -1899,10 +1899,15 @@
     if since_id:
       parameters['since_id'] = since_id

-    if not term:
+    if term is None and geocode is None:
       return []

-    parameters['q'] = urllib.quote_plus(term)
+    # if not term:
+    #   return []
+
+    if term is not None:
+      parameters['q'] = urllib.quote_plus(term)
+
     parameters['show_user'] = show_user
     parameters['lang'] = lang
     parameters['rpp'] = per_page

Original issue reported on code.google.com by adam.a...@gmail.com on 6 Sep 2010 at 7:06

GoogleCodeExporter commented 8 years ago
change applied in changeset 220:b105d4914738

Original comment by bear42 on 14 Nov 2010 at 6:54