diff --git a/pulsar/client/interface.py b/pulsar/client/interface.py index 0882c91b595f06059f9ccb466e494e4d9b93b0f0..67cf44dccd1633443ce61b7c160dce0ab0feffc1 100644 --- a/pulsar/client/interface.py +++ b/pulsar/client/interface.py @@ -3,14 +3,12 @@ from abc import abstractmethod from string import Template from six import BytesIO +from six.moves.urllib.parse import urlencode +from six.moves.urllib.parse import urljoin try: from six import text_type except ImportError: from galaxy.util import unicodify as text_type -try: - from urllib import urlencode -except ImportError: - from urllib.parse import urlencode from .util import copy_to_path @@ -85,10 +83,13 @@ class HttpPulsarInterface(PulsarInterface): self.transport = transport remote_host = destination_params.get("url") assert remote_host is not None, "Failed to determine url for Pulsar client." - if not remote_host.endswith("/"): - remote_host = "%s/" % remote_host if not remote_host.startswith("http"): remote_host = "http://%s" % remote_host + if not remote_host.endswith("/"): + remote_host = "%s/" % remote_host + manager = destination_params.get("manager", None) + if manager: + remote_host = urljoin(remote_host, "managers/%s" % manager) self.remote_host = remote_host self.private_token = destination_params.get("private_token", None)