From 9715a9ad6d6f609ef5545a6e28a9e741fed55a23 Mon Sep 17 00:00:00 2001 From: denise Date: Fri, 15 Feb 2013 12:55:57 -0500 Subject: [PATCH] CC-4883: Python services contacting Apache with strange URL format -fixed --- python_apps/api_clients/api_client.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/python_apps/api_clients/api_client.py b/python_apps/api_clients/api_client.py index e8dbbd16a..ccdde9e3c 100644 --- a/python_apps/api_clients/api_client.py +++ b/python_apps/api_clients/api_client.py @@ -112,7 +112,9 @@ class RequestProvider(object): def __init__(self, cfg): self.config = cfg self.requests = {} - self.url = ApcUrl("http://%s:%s/%s/%s/%s" \ + if self.config["base_dir"].startswith("/"): + self.config["base_dir"] = self.config["base_dir"][1:] + self.url = ApcUrl("http://%s:%s/%s%s/%s" \ % (self.config["host"], str(self.config["base_port"]), self.config["base_dir"], self.config["api_base"], '%%action%%')) @@ -243,7 +245,9 @@ class AirtimeApiClient(object): def construct_url(self,config_action_key): """Constructs the base url for every request""" # TODO : Make other methods in this class use this this method. - url = "http://%s:%s/%s/%s/%s" % \ + if self.config["base_dir"].startswith("/"): + self.config["base_dir"] = self.config["base_dir"][1:] + url = "http://%s:%s/%s%s/%s" % \ (self.config["host"], str(self.config["base_port"]), self.config["base_dir"], self.config["api_base"], self.config[config_action_key])