{"id":1772,"library":"url-normalize","title":"URL Normalize","description":"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.","status":"active","version":"2.2.1","language":"en","source_language":"en","source_url":"https://github.com/niksite/url-normalize","tags":["url","normalization","web","uri","idn"],"install":[{"cmd":"pip install url-normalize","lang":"bash","label":"Install with pip"}],"dependencies":[{"reason":"Required for IDNA 2008 and UTS46 processing for internationalized domain names.","package":"idna","optional":false}],"imports":[{"note":"The primary normalization function `url_normalize` is typically imported directly from the package, not accessed as an attribute of the top-level `url_normalize` package.","wrong":"import url_normalize","symbol":"url_normalize","correct":"from url_normalize import url_normalize"}],"quickstart":{"code":"from url_normalize import url_normalize\n\n# Basic normalization\nnormalized_url = url_normalize(\"HTTP://www.Example.com:80/a/../b?c=2&c=1\")\nprint(f\"Normalized URL: {normalized_url}\")\n# Expected: https://www.example.com/b?c=1&c=2\n\n# Normalizing a path with a default domain and scheme\nnormalized_path = url_normalize(\"/foo/bar\", default_domain=\"example.com\", default_scheme=\"http\")\nprint(f\"Normalized path with domain: {normalized_path}\")\n# Expected: http://example.com/foo/bar\n","lang":"python","description":"Demonstrates basic URL normalization and how to normalize a path by providing a default domain and scheme."},"warnings":[{"fix":"If your application relies on 'http' as the default, explicitly set `default_scheme='http'` when calling `url_normalize`.","message":"The default scheme for URLs without one has changed from 'http' to 'https'.","severity":"breaking","affected_versions":"2.0.0 and later"},{"fix":"Upgrade your Python environment to 3.8 or newer. For older Python versions, use `url-normalize` versions prior to 2.0.0.","message":"The minimum required Python version has been updated to 3.8.","severity":"breaking","affected_versions":"2.0.0 and later"},{"fix":"Ensure the `idna` package is installed (`pip install idna`). Review IDN-specific normalization behavior as it might differ slightly from previous versions.","message":"IDNA handling has been migrated to use IDNA 2008 with UTS46 processing, requiring the `idna` package.","severity":"breaking","affected_versions":"2.0.0 and later"},{"fix":"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.","message":"The `sort_query_params` option has been removed as it was deemed incorrect in its previous implementation.","severity":"breaking","affected_versions":"2.0.0 and later"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}