From 68c0f829361faecf35664df8744183d2cf68be6b Mon Sep 17 00:00:00 2001 From: Joshua Date: Thu, 28 Jan 2010 20:29:55 -0600 Subject: [PATCH] API.search() now includes search meta data as attributes of the ResultSet object returned. Example: results = api.search('python') print 'Search took %s seconds' % results.completed_in This fixes issue #10 (http://github.com/joshthecoder/tweepy/issues/#issue/10) Meta data available as of today: max_id, since_id, refresh_url, next_page, results_per_page, page, completed_in, query --- tweepy/parsers.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/tweepy/parsers.py b/tweepy/parsers.py index 564c8f9..16ee1dc 100644 --- a/tweepy/parsers.py +++ b/tweepy/parsers.py @@ -231,11 +231,19 @@ def parse_search_result(obj, api): def parse_search_results(obj, api): - results = obj['results'] - result_objects = ResultSet() - for item in results: - result_objects.append(parse_search_result(item, api)) - return result_objects + results = ResultSet() + results.max_id = obj.get('max_id') + results.since_id = obj.get('since_id') + results.refresh_url = obj.get('refresh_url') + results.next_page = obj.get('next_page') + results.results_per_page = obj.get('results_per_page') + results.page = obj.get('page') + results.completed_in = obj.get('completed_in') + results.query = obj.get('query') + + for item in obj['results']: + results.append(parse_search_result(item, api)) + return results def parse_list(obj, api): -- 2.25.1