X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osmclient%2Fsol005%2Fclient.py;h=a106c49a11c610d98b097095fc909dc81053d0c0;hb=bc9d075ba034d69b6b4647c06261852aacec407e;hp=70d5c1318a487dc5eea733b1a1fb0e6f41da86ad;hpb=ea593ec357b5e83ac373f3f3fe341449116e5e2d;p=osm%2Fosmclient.git diff --git a/osmclient/sol005/client.py b/osmclient/sol005/client.py index 70d5c13..a106c49 100644 --- a/osmclient/sol005/client.py +++ b/osmclient/sol005/client.py @@ -48,7 +48,7 @@ class Client(object): def __init__( self, host=None, - so_port=9999, + so_port=443, user="admin", password="admin", project="admin", @@ -63,17 +63,17 @@ class Client(object): self._auth_endpoint = "/admin/v1/tokens" self._headers = {} self._token = None - if len(host.split(":")) > 1: - # backwards compatible, port provided as part of host - self._host = host.split(":")[0] - self._so_port = host.split(":")[1] + self._url = None + if host.startswith("http://") or host.startswith("https://"): + self._url = host else: - self._host = host - self._so_port = so_port - - self._http_client = http.Http( - "https://{}:{}/osm".format(self._host, self._so_port), **kwargs - ) + host_fields = host.split(":") + if len(host_fields) > 1: + # backwards compatible, port provided as part of host + host = host_fields[0] + so_port = host_fields[1] + self._url = "https://{}:{}/osm".format(host, so_port) + self._http_client = http.Http(self._url, **kwargs) self._headers["Accept"] = "application/json" self._headers["Content-Type"] = "application/yaml" self._http_client.set_http_header(self._headers) @@ -103,7 +103,7 @@ class Client(object): self.utils = utils.Utils(http_client, **kwargs) """ - def get_token(self, pwd_change=None): + def get_token(self, pwd_change=False): self._logger.debug("") if self._token is None: postfields_dict = {