def process_request(self,req): try: path = req.path_info.split('/builds/proxy/')[1] except IndexError: # no trailing slash ex. raise HTTPNotFound("Invalid proxy url, no trailing slash") t_url = "%s/httpAuth/%s?%s" % (self.options['base_url'], path,req.environ['QUERY_STRING']) tc = TeamCityQuery(self.options) try: response = tc.http_query(t_url) except TeamCityError, e: raise HTTPBadGateway('An error occured during proxy request to %s: %s' % (t_url, e))