add https flag to python cli (#1942)

* add https flag to python cli

* update changelog

Co-authored-by: Liron Ilouz <liron@tapwithus.com>
main
Liron Ilouz 6 years ago committed by GitHub
parent 94f58a505b
commit 7679434bc2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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 (<https://github.com/opencv/cvat/pull/1192>)
- Source type support for CVAT Dumper/Loader (<https://github.com/opencv/cvat/pull/1192>)
- Intelligent polygon editing (<https://github.com/opencv/cvat/pull/1921>)
- python cli over https (<https://github.com/opencv/cvat/pull/1942>)
### Changed
- Smaller object details (<https://github.com/opencv/cvat/pull/1877>)

@ -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**

@ -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__)

@ -179,8 +179,9 @@ class CLI():
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):

@ -78,6 +78,12 @@ parser.add_argument(
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',

Loading…
Cancel
Save