import time
+class ResultSet(list):
+ """A list like object that holds results from a Twitter API query."""
+
+
def _parse_cursor(obj):
return obj['next_cursor'], obj['prev_cursor']
else:
item_list = obj
- users = []
+ users = ResultSet()
for item in item_list:
if item is None: break # sometimes an empty list with a null in it
users.append(parse_user(item, api))
def parse_statuses(obj, api):
- statuses = []
+ statuses = ResultSet()
for item in obj:
statuses.append(parse_status(item, api))
return statuses
def parse_directmessages(obj, api):
- directmessages = []
+ directmessages = ResultSet()
for item in obj:
directmessages.append(parse_dm(item, api))
return directmessages
def parse_saved_searches(obj, api):
- saved_searches = []
+ saved_searches = ResultSet()
saved_search = api.model_factory.saved_search()
for item in obj:
saved_searches.append(parse_saved_search(item, api))
def parse_search_results(obj, api):
results = obj['results']
- result_objects = []
+ result_objects = ResultSet()
for item in results:
result_objects.append(parse_search_result(item, api))
return result_objects
def parse_lists(obj, api):
- lists = []
+ lists = ResultSet()
for item in obj['lists']:
lists.append(parse_list(item, api))
return lists