diff --git a/CHANGELOG.md b/CHANGELOG.md index 87dc74e1..edb12cc2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ filters and searching the nearest frame without any annotations () - A key to remove a point from a polyshape [Ctrl => Alt] () - Updated `docker-compose` file version from `2.3` to `3.3`() +- Added auto inference of url schema from host in CLI, if provided () ### Deprecated - diff --git a/utils/cli/core/core.py b/utils/cli/core/core.py index 78a2776c..78e1680a 100644 --- a/utils/cli/core/core.py +++ b/utils/cli/core/core.py @@ -182,8 +182,13 @@ class CVAT_API_V1(): """ Build parameterized API URLs """ def __init__(self, host, https=False): - prefix = 'https' if https else 'http' - self.base = '{}://{}/api/v1/'.format(prefix, host) + if host.startswith('https://'): + https = True + if host.startswith('http://') or host.startswith('https://'): + host = host.replace('http://', '') + host = host.replace('https://', '') + scheme = 'https' if https else 'http' + self.base = '{}://{}/api/v1/'.format(scheme, host) @property def tasks(self):