From 09c3e3a6948a40c8178069ad9a18183dd0d78659 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Wed, 31 Oct 2012 10:47:08 -0400 Subject: [PATCH] Refactored get_schedule not to suck --- python_apps/api_clients/api_client.py | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/python_apps/api_clients/api_client.py b/python_apps/api_clients/api_client.py index 19484fd14..2b2e6acbc 100644 --- a/python_apps/api_clients/api_client.py +++ b/python_apps/api_clients/api_client.py @@ -205,22 +205,9 @@ class AirtimeApiClient(object): def get_schedule(self): # TODO : properly refactor this routine - logger = self.logger - - # Construct the URL - export_url = self.construct_url("export_url") - logger.info("Fetching schedule from %s", export_url) - - response = "" - try: - response_json = self.get_response_from_server(export_url) - response = json.loads(response_json) - success = True - except Exception, e: - logger.error(e) - success = False - - return success, response + # For now thre return type is a little fucked for compatibility reasons + try: return (True, self.services.export_url()) + except: (False, "") def notify_liquidsoap_started(self): return self.services.notify_liquidsoap_started()