url_unsafe/url_unsafe
2022-07-19 15:50:52 -04:00

21 lines
754 B
Python
Executable File

#!/usr/bin/env python3
# A simple tool to parse urlsafe strings and return them to URL format.
# imports
import argparse
import sys
from urllib.parse import *
version = "2022.07.19"
cmd_args = argparse.ArgumentParser(description='Set urlsafe strings back to regularly formatted URLs.')
cmd_args.add_argument('--version', '-v', dest='print_version', action='store_true',
help='Print the current version number.')
cmd_args.add_argument('safe_string', type=str, nargs='?', default=" ", help="The string to convert from urlsafe to a URL.");
args = cmd_args.parse_args()
if args.print_version:
print("Script version: " + version)
sys.exit()
else:
print(unquote(args.safe_string, encoding='utf-8', errors='replace'))