From 82632c6cfcd266de60083adda0724103433d7f2f Mon Sep 17 00:00:00 2001 From: Josh Roesslein Date: Fri, 6 Nov 2009 17:53:14 -0600 Subject: [PATCH] Update retweet parsing for new payload format. --- CHANGES | 1 + tweepy/api.py | 2 +- tweepy/parsers.py | 20 ++------------------ 3 files changed, 4 insertions(+), 19 deletions(-) diff --git a/CHANGES b/CHANGES index 1331c73..0d7cf85 100644 --- 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] ===================== diff --git a/tweepy/api.py b/tweepy/api.py index 9f90817..1c8ac24 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -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) diff --git a/tweepy/parsers.py b/tweepy/parsers.py index 5b442a1..b99deb3 100644 --- a/tweepy/parsers.py +++ b/tweepy/parsers.py @@ -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): -- 2.25.1