Created
July 24, 2025 21:15
-
-
Save Techcable/c1ac7e8376e2cc39f73d8e5ece4b3d7f to your computer and use it in GitHub Desktop.
A small script to join URLs against a base path
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
"""A command line interface to urllib.parse.urljoin""" | |
import argparse | |
from urllib.parse import urljoin | |
def main() -> None: | |
parser = argparse.ArgumentParser() | |
parser.add_argument("base", help="The base URL") | |
parser.add_argument("urls", help="The URLs to join against the base", nargs="+") | |
args = parser.parse_args() | |
for u in args.urls: | |
print(urljoin(args.base, u)) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment