urltools-cli
Parse, build, and manipulate URLs from the command line.
Installation
pip install urltools-cli
Features
- Parse URLs into components (scheme, host, port, path, query, fragment)
- Build URLs from individual parts
- Modify query parameters (add, remove, set, clear)
- Join base URLs with paths
- Encode/decode URL components
- Compare two URLs for differences
- Replace specific components
- Normalize URLs (lowercase, remove default ports, sort params)
- Validate URL structure
Usage
Parse URLs
# Full breakdown
urltools parse "https://user:pass@example.com:8080/path?q=1&r=2#section"
# Extract single component
urltools parse "https://api.example.com/v1/users" -c host
# → api.example.com
# Get query params as JSON
urltools parse "https://example.com?foo=bar&baz=qux" -c params --json
# → {"foo": "bar", "baz": "qux"}
Build URLs
# Basic URL
urltools build --host example.com --path /api/v1
# → https://example.com/api/v1
# With port and query params
urltools build -h api.example.com -p 8080 --path /users -q limit=10 -q offset=0
# → https://api.example.com:8080/users?limit=10&offset=0
# With auth
urltools build -h db.local -u admin -w secret -p 5432 --path /mydb
# → https://admin:secret@db.local:5432/mydb
Modify Query Parameters
# Add params
urltools params "https://example.com?a=1" --add b=2 --add c=3
# → https://example.com?a=1&b=2&c=3
# Remove params
urltools params "https://example.com?a=1&b=2&c=3" --remove a --remove c
# → https://example.com?b=2
# Set (replace or add)
urltools params "https://example.com?page=1" --set page=2
# → https://example.com?page=2
# Clear all and start fresh
urltools params "https://example.com?old=junk" --clear --add fresh=value
# → https://example.com?fresh=value
# Output params as JSON
urltools params "https://example.com?a=1&b=2" --json
# → {"a": "1", "b": "2"}
Join URLs
urltools join "https://example.com/api/" "users"
# → https://example.com/api/users
urltools join "https://example.com/api/v1" "/v2/users"
# → https://example.com/v2/users
urltools join "https://example.com/old/path" "../new"
# → https://example.com/new
Encode/Decode
# URL encode
urltools encode "hello world"
# → hello%20world
urltools encode "hello world" --plus
# → hello+world
# URL decode
urltools decode "hello%20world"
# → hello world
# Pipe support
echo "encode this" | urltools encode
Compare URLs
urltools compare "https://a.com/path?x=1" "https://b.com/path?x=2"
# netloc:
# url1: a.com
# url2: b.com
# params:
# x:
# url1: 1
# url2: 2
urltools compare "https://a.com" "https://a.com"
# URLs are equivalent
Replace Components
urltools replace "http://example.com/path" --scheme https
# → https://example.com/path
urltools replace "https://old.com/api" --host new.com
# → https://new.com/api
urltools replace "https://example.com:8080/" --port 443
# → https://example.com:443/
Normalize URLs
urltools normalize "HTTP://EXAMPLE.COM:80/Path"
# → http://example.com/Path
urltools normalize "https://example.com:443/api?b=2&a=1"
# → https://example.com/api?a=1&b=2
Validate URLs
urltools validate "https://example.com" && echo "Valid"
# Valid
urltools validate "not-a-url" || echo "Invalid"
# Invalid: Missing scheme
For AI Agents
See SKILL.md for agent-optimized documentation.
License
MIT
Metadata
Release files for urltools-cli 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| urltools_cli-0.1.0.tar.gz | 8.4 kB | Without provenance | Details for urltools_cli-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| urltools_cli-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for urltools_cli-0.1.0-py3-none-any.whl |
Total release size: 16.5 kB
Release files / urltools_cli-0.1.0.tar.gz
| Download URL | urltools_cli-0.1.0.tar.gz |
|---|---|
| Size | 8.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a93d30191f13d1e84debacd79456966c2b178fff611d921245af0f811a3ebc03
|
|
BLAKE2b-256 checksum How to use checksums |
c2538fc1a0397d452a340c935e36bf2b5dbbc499cc49c7d6c9b89d741c319ae2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Release files / urltools_cli-0.1.0-py3-none-any.whl
| Download URL | urltools_cli-0.1.0-py3-none-any.whl |
|---|---|
| Size | 8.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ab851200678214ca176aff4b9a60df6563d77ab8342385752e6f204468c4307b
|
|
BLAKE2b-256 checksum How to use checksums |
685cffc2f151e1dad0dd9c235975fb69c2d7638520aeb41deda7b97943f53223
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Security for urltools-cli 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.