To handle parsers without model_factory attribute or model factories without status attribute
results.count = metadata.get('count')
results.next_results = metadata.get('next_results')
- status_model = getattr(api.parser.model_factory, 'status') if api else Status
+ try:
+ status_model = api.parser.model_factory.status
+ except AttributeError:
+ status_model = Status
for status in json['statuses']:
results.append(status_model.parse(api, status))