URL Normalize is a Python library (current version 2.2.1) designed for standardizing and normalizing URLs, including support for internationalized domain names (IDN). It handles various aspects like scheme and host lowercasing, percent-encoding, path segment collapsing, and configurable default schemes and query parameter filtering. It is actively maintained with regular releases.
pip install url-normalizeVerified import paths — ran on the pinned version, not inferred.
Demonstrates basic URL normalization and how to normalize a path by providing a default domain and scheme.
If your application relies on 'http' as the default, explicitly set `default_scheme='http'` when calling `url_normalize`.
Upgrade your Python environment to 3.8 or newer. For older Python versions, use `url-normalize` versions prior to 2.0.0.
Ensure the `idna` package is installed (`pip install idna`). Review IDN-specific normalization behavior as it might differ slightly from previous versions.
Remove the `sort_query_params` argument from your `url_normalize` calls. Query parameters are now sorted by default. If specific custom sorting is needed, it must be applied manually before normalization.
Install the package using pip: `pip install url-normalize`
Ensure the argument passed to `url_normalize` is always a string. Example: `from url_normalize import url_normalize; url_normalize('http://example.com')`Provide only the scheme name for the `default_scheme` parameter. Example: `from url_normalize import url_normalize; url_normalize('//example.com', default_scheme='https')`Ensure the IDN part of the URL is a valid and properly formatted Unicode string that can be encoded by the `idna` codec. Example: `from url_normalize import url_normalize; url_normalize('http://xn--fsk.example.com')`