check to see whether site starts with http(s)://

This commit is contained in:
Lynnesbian 2020-03-10 16:53:30 +10:00
parent dbd74ed6fe
commit 8db84a5656
No known key found for this signature in database
GPG Key ID: F0A184B5213D9F90
1 changed files with 4 additions and 0 deletions

View File

@ -35,6 +35,10 @@ try:
except FileNotFoundError: except FileNotFoundError:
open(args.cfg, "w").write("{}") open(args.cfg, "w").write("{}")
if not cfg['site'].startswith("https://") and not cfg['site'].startswith("http://"):
print("Site must begin with 'https://' or 'http://'. Value '{}' is invalid - try 'https://{}' instead.".format(cfg['site']))
sys.exit(1)
print("Using {} as configuration file".format(args.cfg)) print("Using {} as configuration file".format(args.cfg))
if "client" not in cfg: if "client" not in cfg: