1
0
Fork 0

Renamed option for skipping SSL verification to -k/--insecure (referencing curl)

This commit is contained in:
Salvoxia 2024-07-30 20:38:28 +02:00
parent a503c964cf
commit e392f7a9d7

View file

@ -26,7 +26,7 @@ parser.add_argument("-s", "--album-separator", default=" ", type=str, help="Sepa
parser.add_argument("-c", "--chunk-size", default=2000, type=int, help="Maximum number of assets to add to an album with a single API call")
parser.add_argument("-C", "--fetch-chunk-size", default=5000, type=int, help="Maximum number of assets to fetch with a single API call")
parser.add_argument("-l", "--log-level", default="INFO", choices=['CRITICAL', 'ERROR', 'WARNING', 'INFO', 'DEBUG'], help="Log level to use")
parser.add_argument("-i", "--ignore-ssl", action="store_true", help="Set to true to ignore SSL verification")
parser.add_argument("-k", "--insecure", action="store_true", help="Set to true to ignore SSL verification")
args = vars(parser.parse_args())
# set up logger to log in logfmt format
logging.basicConfig(level=args["log_level"], stream=sys.stdout, format='time=%(asctime)s level=%(levelname)s msg=%(message)s')
@ -42,7 +42,7 @@ album_levels = args["album_levels"]
# Album Levels Range handling
album_levels_range_arr = ()
album_level_separator = args["album_separator"]
ignore_ssl = args["ignore_ssl"]
insecure = args["insecure"]
logging.debug("root_path = %s", root_paths)
logging.debug("root_url = %s", root_url)
logging.debug("api_key = %s", api_key)
@ -52,14 +52,14 @@ logging.debug("unattended = %s", unattended)
logging.debug("album_levels = %s", album_levels)
#logging.debug("album_levels_range = %s", album_levels_range)
logging.debug("album_level_separator = %s", album_level_separator)
logging.debug("ignore_ssl = %s", ignore_ssl)
logging.debug("insecure = %s", insecure)
# Verify album levels
if is_integer(album_levels) and album_levels == 0:
parser.print_help()
exit(1)
if ignore_ssl:
if insecure:
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
# Verify album levels range
@ -101,7 +101,7 @@ requests_kwargs = {
'Content-Type': 'application/json',
'Accept': 'application/json'
},
'verify' : not ignore_ssl
'verify' : not insecure
}
# Yield successive n-sized