Update retweet parsing for new payload format.
authorJosh Roesslein <jroesslein@gmail.com>
Fri, 6 Nov 2009 23:53:14 +0000 (17:53 -0600)
committerJosh Roesslein <jroesslein@gmail.com>
Fri, 6 Nov 2009 23:53:14 +0000 (17:53 -0600)
CHANGES
tweepy/api.py
tweepy/parsers.py

diff --git a/CHANGES b/CHANGES
index 1331c73b19c02482851c50b2571ff2eed39d01a0..0d7cf85617e80487dd5d0e4d000dcd5ef5260889 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -13,6 +13,7 @@ during upgrade will be listed here.
 + API.auth_handler -> API.auth
 + Moved memcache implementation to tweepy-more repository.
 + Tweepy now uses the versioned API and the new api.twitter.com subdomain
++ Updated retweet parsing for new payload format
 
 1.1 -> 1.2 [Current]
 =====================
index 9f90817015f24a641eb3c84b72618ca85e8d82a5..1c8ac248dbd076366c1d11ea2f1b80232389e017 100644 (file)
@@ -130,7 +130,7 @@ class API(object):
     def retweets(self, id, *args, **kargs):
         return bind_api(
             path = '/statuses/retweets/%s.json' % id,
-            parser = parse_retweets,
+            parser = parse_statuses,
             allowed_param = ['count'],
             require_auth = True
         )(self, *args, **kargs)
index 5b442a124f6c0f10c1de729b18a262cf7a844164..b99deb3e345eea9fdf9a4fbcd842b442eecf84cd 100644 (file)
@@ -127,8 +127,8 @@ def parse_status(obj, api):
         elif k == 'source':
             setattr(status, k, _parse_html_value(v))
             setattr(status, 'source_url', _parse_a_href(v))
-        elif k == 'retweet_details':
-            setattr(status, k, parse_retweet(v, api))
+        elif k == 'retweeted_status':
+            setattr(status, k, parse_status(v, api))
         else:
             setattr(status, k, v)
     return status
@@ -230,22 +230,6 @@ def parse_search_results(obj, api):
         result_objects.append(parse_search_result(item, api))
     return result_objects
 
-def _parse_retweet(obj, api):
-
-    retweet = models['retweet']()
-    for k,v in obj.items():
-        if k == 'retweeting_user':
-            setattr(retweet, k, parse_user(v, api))
-        else:
-            setattr(retweet, k, v)
-    return retweet
-
-def parse_retweets(obj, api):
-
-    retweets = []
-    for item in obj:
-        retweets.append(parse_retweet(item, api))
-    return retweets
 
 def parse_list(obj, api):