|
|
|
@ -98,6 +98,8 @@ class Client:
|
|
|
|
schema = ""
|
|
|
|
schema = ""
|
|
|
|
base_url = url
|
|
|
|
base_url = url
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
base_url = base_url.rstrip("/")
|
|
|
|
|
|
|
|
|
|
|
|
if schema and schema not in cls.ALLOWED_SCHEMAS:
|
|
|
|
if schema and schema not in cls.ALLOWED_SCHEMAS:
|
|
|
|
raise InvalidHostException(
|
|
|
|
raise InvalidHostException(
|
|
|
|
f"Invalid url schema '{schema}', expected "
|
|
|
|
f"Invalid url schema '{schema}', expected "
|
|
|
|
@ -279,7 +281,7 @@ class CVAT_API_V2:
|
|
|
|
"""Build parameterized API URLs"""
|
|
|
|
"""Build parameterized API URLs"""
|
|
|
|
|
|
|
|
|
|
|
|
def __init__(self, host: str):
|
|
|
|
def __init__(self, host: str):
|
|
|
|
self.host = host
|
|
|
|
self.host = host.rstrip("/")
|
|
|
|
self.base = self.host + "/api/"
|
|
|
|
self.base = self.host + "/api/"
|
|
|
|
self.git = self.host + "/git/repository/"
|
|
|
|
self.git = self.host + "/git/repository/"
|
|
|
|
|
|
|
|
|
|
|
|
@ -308,7 +310,7 @@ class CVAT_API_V2:
|
|
|
|
def make_client(
|
|
|
|
def make_client(
|
|
|
|
host: str, *, port: Optional[int] = None, credentials: Optional[Tuple[int, int]] = None
|
|
|
|
host: str, *, port: Optional[int] = None, credentials: Optional[Tuple[int, int]] = None
|
|
|
|
) -> Client:
|
|
|
|
) -> Client:
|
|
|
|
url = host
|
|
|
|
url = host.rstrip("/")
|
|
|
|
if port:
|
|
|
|
if port:
|
|
|
|
url = f"{url}:{port}"
|
|
|
|
url = f"{url}:{port}"
|
|
|
|
|
|
|
|
|
|
|
|
|