Skip to content

Commit

Permalink
add https flag to python cli (#1942)
Browse files Browse the repository at this point in the history
* add https flag to python cli

* update changelog

Co-authored-by: Liron Ilouz <liron@tapwithus.com>
  • Loading branch information
ilouzl and Liron Ilouz authored Jul 28, 2020
1 parent 94f58a5 commit 7679434
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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>)
Expand Down
2 changes: 2 additions & 0 deletions utils/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**
Expand Down
2 changes: 1 addition & 1 deletion utils/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand Down
5 changes: 3 additions & 2 deletions utils/cli/core/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
6 changes: 6 additions & 0 deletions utils/cli/core/definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 7679434

Please sign in to comment.