Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add https flag to python cli #1942

Merged
merged 3 commits into from
Jul 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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