URL manipulation made simple.
65
A utility that canonicalizes user-supplied URLs while enforcing encoding rules and validating hosts and ports.
https://Tést.Example/mañana/agenda?q=niño&redirect=/a b to https://xn--tst-6la.example/ma%C3%B1ana/agenda?q=ni%C3%B1o&redirect=%2Fa%20b @testhttp://example.com:70000/report raises a ValueError for an out-of-range port instead of silently correcting it @teststrict=True, normalizing https://example.com/a b/c?q=needs encoding emits a UserWarning about encoding and returns https://example.com/a%20b/c?q=needs+encoding @test@generates
def normalize_url(raw_url: str, *, strict: bool = False) -> str:
"""
Normalize a user-supplied URL string into a canonical, encoded form.
- Converts Unicode hosts to IDNA/punycode
- Percent-encodes path and query components while preserving order and repeated parameters
- Validates hosts and ports and raises ValueError on invalid input
- When strict is True, emits a UserWarning on improperly encoded path or query input before returning the normalized URL
"""URL parsing/manipulation library with IDNA support, encoding-aware components, strict warnings, and host/port validation.
Install with Tessl CLI
npx tessl i tessl/pypi-furlevals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10