Make trusted flag available as an option for wxget.py and fix some minor issues.

This commit is contained in:
Steve Barnes
2017-09-22 12:06:38 +01:00
parent 82a5a09b3d
commit 22f21b369e

View File

@@ -24,6 +24,7 @@ Usage:
Where URL is a file URL and the optional DEST_DIR is a destination directory to
download to, (default is to prompt the user).
The --trusted option can be used to surpress certificate checks.
"""
from __future__ import (division, absolute_import, print_function, unicode_literals)
@@ -213,11 +214,17 @@ def main(args=sys.argv):
dest_dir = '.'
force_flag = '--force'
trusted_flag = '--trusted'
force = False
trusted = False
if force_flag in args:
force = True
args.remove(force_flag)
if trusted_flag in args:
trusted = True
args.remove(force_flag)
if len(args) > 2:
dest_dir = args[2]
else:
@@ -234,7 +241,7 @@ def main(args=sys.argv):
else:
url = None
if url:
FILENAME = download_file(url, dest_dir, force)
FILENAME = download_file(url, dest_dir, force, trusted)
print(FILENAME)
if __name__ == "__main__": # Only run if this file is called directly