{"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":"python","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,"search_vec":"'2.2.1':11 'activ':50 'aspect':28 'collaps':39 'configur':41 'current':9 'default':42 'design':12 'domain':22 'encod':36 'filter':47 'handl':26 'host':32 'idn':24,59 'includ':18 'internation':21 'librari':8 'like':29 'lowercas':33 'maintain':51 'name':23 'normal':2,4,16,56 'paramet':46 'path':37 'percent':35 'percent-encod':34 'python':7 'queri':45 'regular':53 'releas':54 'scheme':30,43 'segment':38 'standard':14 'support':19 'uri':58 'url':1,3,17,55 'various':27 'version':10 'web':57","created_at":"2026-04-09T04:02:27.955011+00:00","updated_at":"2026-04-16T23:59:52.748919+00:00","problems":[{"fix":"Install the package using pip: `pip install url-normalize`","cause":"The `url-normalize` package has not been installed in your Python environment.","error":"ModuleNotFoundError: No module named 'url_normalize'"},{"fix":"Ensure the argument passed to `url_normalize` is always a string. Example: `from url_normalize import url_normalize; url_normalize('http://example.com')`","cause":"The `url_normalize` function received a non-string argument (e.g., `None`, an integer, or a list) instead of a URL string.","error":"TypeError: url must be str, not NoneType"},{"fix":"Provide only the scheme name for the `default_scheme` parameter. Example: `from url_normalize import url_normalize; url_normalize('//example.com', default_scheme='https')`","cause":"The `default_scheme` parameter was provided with a colon (e.g., 'http://') instead of just the scheme name (e.g., 'http').","error":"ValueError: default_scheme must not contain a colon"},{"fix":"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')`","cause":"The URL contains an invalid Internationalized Domain Name (IDN) that cannot be properly encoded according to IDNA rules, often due to invalid characters or formatting.","error":"idna.core.IDNAError: Invalid character"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"3.0.0","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/niksite/url-normalize","docs":null,"changelog":"https://github.com/niksite/url-normalize/blob/master/CHANGELOG.md","pypi":"https://pypi.org/project/url-normalize/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["http-networking"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-27","next_check":"2026-07-28","install_tag":null}}