Esempio n. 1
0
 def read_catalog(self, catalog_id, start, results, callback):
     params = self.get_base_params()
     params.update({
         'id': catalog_id,
         'start': start,
         'results': results,
     })
     base_url = "http://developer.echonest.com/api/v4/catalog/read"
     req = tornado.httpclient.HTTPRequest(
         url = base_url + "?" + base.format_params(params),
         method = "GET",
     )
     response = yield tornado.gen.Task(self.application.http_client.fetch, req)
     callback(json.loads(response.buffer.read()))
Esempio n. 2
0
 def profile_catalog(self, catalog_id, catalog_name, callback):
     params = self.get_base_params()
     if catalog_id:
         params['id'] = catalog_id
     elif catalog_name:
         params['name'] = catalog_name
     else:
         raise Exception("you must provide one of catalog_id | catalog_name!")
     base_url = "http://developer.echonest.com/api/v4/catalog/profile"
     req = tornado.httpclient.HTTPRequest(
         url = base_url + "?" + base.format_params(params),
         method = "GET",
     )
     response = yield tornado.gen.Task(self.application.http_client.fetch, req)
     callback(json.loads(response.buffer.read()))