From 2659932cfb0a64a7af426c72cf27c0e63a070bbc Mon Sep 17 00:00:00 2001 From: martin Date: Mon, 11 Jul 2011 14:44:23 -0400 Subject: [PATCH] -added new exception for when apache isn't responding --- python_apps/api_clients/api_client.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/python_apps/api_clients/api_client.py b/python_apps/api_clients/api_client.py index d6473809b..fc0fee7f7 100644 --- a/python_apps/api_clients/api_client.py +++ b/python_apps/api_clients/api_client.py @@ -365,12 +365,15 @@ class AirTimeApiClient(ApiClientInterface): try: url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["media_setup_url"]) url = url.replace("%%api_key%%", self.config["api_key"]) - logger.debug(url) response = urllib.urlopen(url) response = json.loads(response.read()) - logger.debug("Json Media Setup %s", response) - + logger.info("Connected to Airtime Server. Json Media Storage Dir: %s", response) + except IOError: + #this should be a common exception when media-monitor daemon + #has started before apache on bootup and apache isn't accepting + #connections yet. + response = None except Exception, e: response = None logger.error("Exception: %s", e)