# URL Tools Zero-dependency URL parser / builder / encoder / decoder. ``` python scripts/run.py parse "https://u:p@host:8080/a/b?x=1&x=2#frag" python scripts/run.py encode "a b/c?d" python scripts/run.py encode "a b" --plus python scripts/run.py decode "a%20b%2Fc" python scripts/run.py build --host example.com --path /search --query q=hello --query lang=en echo "https://example.com?a=1" | python scripts/run.py parse - ``` Pure Python stdlib (`urllib.parse`). --- name: url-tools display_name: URL Tools description: "Parse, build, and percent-encode/decode URLs and query strings; inspect URL components. Triggers: parse url, url encode, url decode, build url, query string, urlencode." --- # URL Tools Parse, build, and encode/decode URLs and query strings from chat. ## When to use The user has a URL and wants to break it into components, see its query parameters, percent-encode or decode a string, or assemble a URL from parts. ## How to use Run `scripts/run.py` with a subcommand: - `python scripts/run.py parse "https://u:p@host:8080/a/b?x=1&x=2#frag"` — dump components + parsed query (JSON). - `python scripts/run.py encode "a b/c?d"` — percent-encode (use `--plus` for form `+` spaces). - `python scripts/run.py decode "a%20b%2Fc"` — percent-decode (use `--plus` to treat `+` as space). - `python scripts/run.py build --host example.com --path /search --query q=hello --query lang=en` — assemble a URL. Any text argument may be `@file` to read from a file, or `-` to read from stdin. ## Pitfalls - `parse` returns `query_params` as lists because a key can repeat (`x=1&x=2`). - `encode` without `--plus` escapes spaces as `%20`; with `--plus` as `+` (use the form-encoding variant only inside query strings). - `build` needs at least `--host` or `--base`, otherwise it exits non-zero.
URL Tools by langbot-team
Parse, build, and percent-encode/decode URLs and query strings; inspect URL components.
Loading...