From a2a14a418be7de9de32b8175c87b0fcc39ec34a8 Mon Sep 17 00:00:00 2001 From: Sarp Uner Date: Mon, 23 Nov 2020 06:38:50 -0500 Subject: [PATCH 1/3] Allow connecting to localhost without https. --- panoptes_cli/commands/configure.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/panoptes_cli/commands/configure.py b/panoptes_cli/commands/configure.py index 51046d8..166f563 100644 --- a/panoptes_cli/commands/configure.py +++ b/panoptes_cli/commands/configure.py @@ -33,7 +33,8 @@ def configure(ctx, edit_all): show_default=not is_password, ) - if not ctx.parent.config['endpoint'].startswith('https://'): + # If not connecting to local host (e.g. panoptes running locally) and endpoint is not https, refuse connection! + if 'localhost' not in ctx.parent.config['endpoint'] and not ctx.parent.config['endpoint'].startswith('https://'): click.echo( 'Error: Invalid endpoint supplied. Endpoint must be an HTTPS URL.' ) From d0003696418acdbe6e4a2aca24700d20aa89364c Mon Sep 17 00:00:00 2001 From: Sarp Uner Date: Mon, 23 Nov 2020 07:06:23 -0500 Subject: [PATCH 2/3] Fixed Hound issues --- panoptes_cli/commands/configure.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/panoptes_cli/commands/configure.py b/panoptes_cli/commands/configure.py index 166f563..279daeb 100644 --- a/panoptes_cli/commands/configure.py +++ b/panoptes_cli/commands/configure.py @@ -33,8 +33,10 @@ def configure(ctx, edit_all): show_default=not is_password, ) - # If not connecting to local host (e.g. panoptes running locally) and endpoint is not https, refuse connection! - if 'localhost' not in ctx.parent.config['endpoint'] and not ctx.parent.config['endpoint'].startswith('https://'): + # If not connecting to local host (e.g. panoptes running locally) + # and endpoint is not https, refuse connection! + if 'localhost' not in ctx.parent.config['endpoint'] \ + and not ctx.parent.config['endpoint'].startswith('https://'): click.echo( 'Error: Invalid endpoint supplied. Endpoint must be an HTTPS URL.' ) From 1dcd0ddd09c49d3a351916b6cfcd3ec2c657e2bb Mon Sep 17 00:00:00 2001 From: Sarp Uner Date: Mon, 23 Nov 2020 07:15:18 -0500 Subject: [PATCH 3/3] Removed trailing white space per Hound and switched to parentheses over backslash for multiline if --- panoptes_cli/commands/configure.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/panoptes_cli/commands/configure.py b/panoptes_cli/commands/configure.py index 279daeb..e2fd6df 100644 --- a/panoptes_cli/commands/configure.py +++ b/panoptes_cli/commands/configure.py @@ -33,10 +33,10 @@ def configure(ctx, edit_all): show_default=not is_password, ) - # If not connecting to local host (e.g. panoptes running locally) + # If not connecting to local host (e.g. panoptes running locally) # and endpoint is not https, refuse connection! - if 'localhost' not in ctx.parent.config['endpoint'] \ - and not ctx.parent.config['endpoint'].startswith('https://'): + if ('localhost' not in ctx.parent.config['endpoint'] + and not ctx.parent.config['endpoint'].startswith('https://')): click.echo( 'Error: Invalid endpoint supplied. Endpoint must be an HTTPS URL.' )