1
2
3
4 """
5 Copyright (c) 2010 The Echo Nest. All rights reserved.
6 Created by Tyler Williams on 2010-04-25.
7 """
8
9 import logging
10 from util import attrdict
11
12
13
14
15
17 - def __init__(self, result_type, result_dict):
18 self._object_type = result_type
19 assert(isinstance(result_dict,dict))
20 self.__dict__.update(result_dict)
21
23 return "<Result - %s>" % (self._object_type)
24
26 return "<Result - %s>" % (self._object_type)
27
29 try:
30 data = accessor_function(response)
31 if isinstance(data, list):
32 return [Result(result_type, item) for item in data]
33 elif isinstance(data, dict):
34 return Result(result_type, data)
35 else:
36 return data
37 except IndexError:
38 logging.info("No songs found")
39