Skip to content

Commit 7679434

Browse files
authored
add https flag to python cli (#1942)
* add https flag to python cli * update changelog Co-authored-by: Liron Ilouz <[email protected]>
1 parent 94f58a5 commit 7679434

File tree

5 files changed

+13
-3
lines changed

5 files changed

+13
-3
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99
- Source type support for tags, shapes and tracks (<https://github.com/opencv/cvat/pull/1192>)
1010
- Source type support for CVAT Dumper/Loader (<https://github.com/opencv/cvat/pull/1192>)
1111
- Intelligent polygon editing (<https://github.com/opencv/cvat/pull/1921>)
12+
- python cli over https (<https://github.com/opencv/cvat/pull/1942>)
1213

1314
### Changed
1415
- Smaller object details (<https://github.com/opencv/cvat/pull/1877>)

utils/cli/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ optional arguments:
3131
host (default: localhost)
3232
--server-port SERVER_PORT
3333
port (default: 8080)
34+
--https
35+
using https connection (default: False)
3436
--debug show debug output
3537
```
3638
**Examples**

utils/cli/cli.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def main():
2828
args = parser.parse_args()
2929
config_log(args.loglevel)
3030
with requests.Session() as session:
31-
api = CVAT_API_V1('%s:%s' % (args.server_host, args.server_port))
31+
api = CVAT_API_V1('%s:%s' % (args.server_host, args.server_port), args.https)
3232
cli = CLI(session, api, args.auth)
3333
try:
3434
actions[args.action](cli, **args.__dict__)

utils/cli/core/core.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,9 @@ def login(self, credentials):
179179
class CVAT_API_V1():
180180
""" Build parameterized API URLs """
181181

182-
def __init__(self, host):
183-
self.base = 'http://{}/api/v1/'.format(host)
182+
def __init__(self, host, https=False):
183+
prefix = 'https' if https else 'http'
184+
self.base = '{}://{}/api/v1/'.format(prefix, host)
184185

185186
@property
186187
def tasks(self):

utils/cli/core/definition.py

+6
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,12 @@ def argparse(s):
7878
default='8080',
7979
help='port (default: %(default)s)'
8080
)
81+
parser.add_argument(
82+
'--https',
83+
default=False,
84+
action='store_true',
85+
help='using https connection (default: %(default)s)'
86+
)
8187
parser.add_argument(
8288
'--debug',
8389
action='store_const',

0 commit comments

Comments
 (0)