Added rest of search API trending methods.
authorJosh Roesslein <jroesslein@gmail.com>
Sun, 13 Sep 2009 19:36:22 +0000 (14:36 -0500)
committerJosh Roesslein <jroesslein@gmail.com>
Sun, 13 Sep 2009 19:36:22 +0000 (14:36 -0500)
CHANGES
README
ROADMAP
tweepy/api.py
tweepy/parsers.py

diff --git a/CHANGES b/CHANGES
index af32436a5fb2e64286c413e8295f513264848e6e..8fca1c07a1d2ad0a48fae46f318906f03c89f6b3 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -13,6 +13,8 @@ during upgrade will be listed here.
     + added new() method. shortcut for setting up new API instances
       example: API.new(auth='basic', username='testuser', password='testpass')
     + update_profile_image() and update_profile_background_image() method added.
+    + Added search API methods: 
+        trends, trends_current, trends_daily, and trends_weekly
 + Streaming:
     + Update to new streaming API methods
     + New StreamListener class replacing callback function
@@ -21,3 +23,5 @@ during upgrade will be listed here.
       when user is not followed.
     + python 2.5 import syntax error fixed
     + python 2.5 timeout support for streaming API
++ Changed indents from 2 to 4 spaces
+
diff --git a/README b/README
index b419b070ae4a23549f737f07f688bf20a30f76e7..9dd3cb03013a2b5cbfbf54e595b85a0dc9a39be8 100644 (file)
--- a/README
+++ b/README
@@ -30,7 +30,8 @@ Souce code:
   Gitorious: <http://gitorious.org/tweepy>
   Github: <http://github.com/joshthecoder/tweepy>
 
-Mailinglist: tweepy@googlegroups.com  (questions/feature request/bug reports/anything else)
+Bug tracker: http://github.com/joshthecoder/tweepy/issues 
+Mailing list: tweepy@googlegroups.com
 
 Author: Joshua Roesslein
 License: MIT
diff --git a/ROADMAP b/ROADMAP
index 626fc6e3c66ed2a40dcb93fc588a65d22e4e1e07..eccf70cfc65f03e685fd90a4fcd5ec827a6c805b 100644 (file)
--- a/ROADMAP
+++ b/ROADMAP
@@ -3,7 +3,7 @@ The plan of attack for the next version of Tweepy.
 1.0 -> 1.0.1
 ============
 + changing profile and background images [DONE]
-+ finish search api
++ finish search api [DONE]
 + autodetect authenticated user's ID [DONE]
 + make oauth handler more web app friendly
 + address file locking portability issues in file cache
index cf22fb7b695f8a85d31b83162977eaa884e5e43a..434645f892f1f1e704ec330e36721ab09654ce30 100644 (file)
@@ -425,9 +425,33 @@ class API(object):
         return bind_api(
             host = 'search.' + self.host,
             path = '/trends.json',
-            parser = parse_trend_results
+            parser = parse_json
         )(self)
 
+    def trends_current(self, *args, **kargs):
+        return bind_api(
+            host = 'search.' + self.host,
+            path = '/trends/current.json',
+            parser = parse_json,
+            allowed_param = ['exclude']
+        )(self, *args, **kargs)
+
+    def trends_daily(self, *args, **kargs):
+        return bind_api(
+            host = "search." + self.host,
+            path = '/trends/daily.json',
+            parser = parse_json,
+            allowed_param = ['date', 'exclude']
+        )(self, *args, **kargs)
+
+    def trends_weekly(self, *args, **kargs):
+        return bind_api(
+            host = "search." + self.host,
+            path = '/trends/weekly.json',
+            parser = parse_json,
+            allowed_param = ['date', 'exclude']
+        )(self, *args, **kargs)
+
     def _pack_image(filename, max_size):
         """Pack image from file into multipart-formdata post body"""
         # image must be less than 700kb in size
index e1dce1e0c63773883ba231b3f3e0478db528ad2f..2731e9e0c506b6cb0c960ef8d305d1117b55ebe0 100644 (file)
@@ -91,7 +91,9 @@ def _parse_status(obj, api):
     status._api = api
     for k, v in obj.items():
         if k == 'user':
-            setattr(status, 'author', _parse_user(v, api))
+            user = _parse_user(v, api)
+            setattr(status, 'author', user)
+            setattr(status, 'user', user)  # DEPRECIATED
         elif k == 'created_at':
             setattr(status, k, _parse_datetime(v))
         elif k == 'source':
@@ -204,8 +206,3 @@ def parse_search_results(data, api):
         result_objects.append(_parse_search_result(obj, api))
     return result_objects
 
-
-def parse_trend_results(data, api):
-
-    return json.loads(data)['trends']
-