diff --git a/CHANGELOG.md b/CHANGELOG.md index 231738bc9146..cf868054ceec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Source type support for tags, shapes and tracks () - Source type support for CVAT Dumper/Loader () - Intelligent polygon editing () +- python cli over https () ### Changed - Smaller object details () diff --git a/utils/cli/README.md b/utils/cli/README.md index 07b708d72125..f582e2e3fbe8 100644 --- a/utils/cli/README.md +++ b/utils/cli/README.md @@ -31,6 +31,8 @@ optional arguments: host (default: localhost) --server-port SERVER_PORT port (default: 8080) + --https + using https connection (default: False) --debug show debug output ``` **Examples** diff --git a/utils/cli/cli.py b/utils/cli/cli.py index 9ac826b4bff4..ae08ad1a3279 100755 --- a/utils/cli/cli.py +++ b/utils/cli/cli.py @@ -28,7 +28,7 @@ def main(): args = parser.parse_args() config_log(args.loglevel) with requests.Session() as session: - api = CVAT_API_V1('%s:%s' % (args.server_host, args.server_port)) + api = CVAT_API_V1('%s:%s' % (args.server_host, args.server_port), args.https) cli = CLI(session, api, args.auth) try: actions[args.action](cli, **args.__dict__) diff --git a/utils/cli/core/core.py b/utils/cli/core/core.py index a51364285e89..a9386884998d 100644 --- a/utils/cli/core/core.py +++ b/utils/cli/core/core.py @@ -179,8 +179,9 @@ def login(self, credentials): class CVAT_API_V1(): """ Build parameterized API URLs """ - def __init__(self, host): - self.base = 'http://{}/api/v1/'.format(host) + def __init__(self, host, https=False): + prefix = 'https' if https else 'http' + self.base = '{}://{}/api/v1/'.format(prefix, host) @property def tasks(self): diff --git a/utils/cli/core/definition.py b/utils/cli/core/definition.py index d8892d19c59f..4e1937ebf5ea 100644 --- a/utils/cli/core/definition.py +++ b/utils/cli/core/definition.py @@ -78,6 +78,12 @@ def argparse(s): default='8080', help='port (default: %(default)s)' ) +parser.add_argument( + '--https', + default=False, + action='store_true', + help='using https connection (default: %(default)s)' +) parser.add_argument( '--debug', action='store_const',