{"id":1771,"library":"uritools","title":"URITools","description":"URITools is a Python library providing comprehensive URI parsing, classification, and composition capabilities. It aims to offer a more consistent and feature-rich alternative to the standard library's `urllib.parse` for handling URIs, ensuring robust and compliant URI manipulation. The current version is 6.0.1, and it maintains a regular, though not rapid, release cadence, with major versions typically every 1-2 years.","status":"active","version":"6.0.1","language":"python","source_language":"en","source_url":"https://github.com/tkem/uritools/","tags":["uri","url","parsing","composition","validation","uri-components"],"install":[{"cmd":"pip install uritools","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"note":"`splituri` was deprecated in v4.x and removed in v5.0.0. Use `urisplit` for parsing.","wrong":"from uritools import splituri","symbol":"urisplit","correct":"from uritools import urisplit"},{"note":"`composeuri` was deprecated in v4.x and removed in v5.0.0. Use `uricompose` for re-assembling URIs.","wrong":"from uritools import composeuri","symbol":"uricompose","correct":"from uritools import uricompose"},{"symbol":"urirecompose","correct":"from uritools import urirecompose"},{"note":"A utility class for working with URI components.","symbol":"uricomponent","correct":"from uritools import uricomponent"}],"quickstart":{"code":"from uritools import urisplit, uricompose\n\n# Parse a URI into its components\nuri_string = 'https://user:pass@www.example.com:8080/foo/bar?q=baz&x=y#frag'\np = urisplit(uri_string)\n\nprint(f\"Scheme: {p.scheme}\")\nprint(f\"Userinfo: {p.userinfo}\")\nprint(f\"Host: {p.host}\")\nprint(f\"Port: {p.port}\")\nprint(f\"Path: {p.path}\")\nprint(f\"Query: {p.query}\")\nprint(f\"Fragment: {p.fragment}\")\n\n# Recompose the URI from its components\nrecomposed_uri = uricompose(p)\nprint(f\"Recomposed URI: {recomposed_uri}\")\n\n# Example of getting query parameters\nprint(f\"Query parameters: {p.get_query_dict()}\")","lang":"python","description":"This quickstart demonstrates how to parse a URI string into its individual components using `urisplit` and then reconstruct it using `uricompose`. It also shows how to access specific components and parse query parameters into a dictionary."},"warnings":[{"fix":"Upgrade your Python environment to 3.10 or later, or pin `uritools` to a version `<6.0.0` for older Python environments (e.g., `pip install uritools<6.0.0`).","message":"Starting with version 6.0.0, `uritools` requires Python 3.10 or newer. Installing on older Python versions will fail.","severity":"breaking","affected_versions":"6.0.0+"},{"fix":"Update your code to use `uritools.urisplit` for parsing and `uritools.uricompose` for composing URIs.","message":"The functions `splituri` and `composeuri` were removed in version 5.0.0. They were deprecated in version 4.x in favor of `urisplit` and `uricompose`.","severity":"breaking","affected_versions":"5.0.0+"},{"fix":"Always consult the `uritools` documentation and be aware of its API differences when migrating from `urllib.parse` or using both libraries. Specifically, `uritools.urisplit` is the primary parsing function, not `uritools.parse` (which does not exist).","message":"`uritools` is an alternative to `urllib.parse`, not a drop-in replacement. While similar in purpose, function names, object structures (e.g., `urisplit` returns a `URIComponents` object, not a tuple), and parsing logic can differ significantly. Direct migration without checking the documentation will likely lead to errors.","severity":"gotcha","affected_versions":"All"},{"fix":"When working with ports, check if `URIComponents.port` is `None`. If it is, you might need to infer the default port based on `URIComponents.scheme` if a default is required for your application logic.","message":"The `port` attribute of the `URIComponents` object (returned by `urisplit`) will be `None` if the port is not explicitly specified in the URI, even if a default port for the scheme exists (e.g., 80 for HTTP, 443 for HTTPS). It will only reflect an explicit port number.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"search_vec":"'-2':63 '1':62 '6.0.1':46 'aim':16 'altern':26 'cadenc':56 'capabl':14 'classif':11 'compliant':39 'compon':72 'composit':13,68 'comprehens':8 'consist':21 'current':43 'ensur':36 'everi':61 'featur':24 'feature-rich':23 'handl':34 'librari':6,30 'maintain':49 'major':58 'manipul':41 'offer':18 'pars':10,67 'provid':7 'python':5 'rapid':54 'regular':51 'releas':55 'rich':25 'robust':37 'standard':29 'though':52 'typic':60 'uri':9,35,40,65,71 'uri-compon':70 'uritool':1,2 'url':66 'urllib.parse':32 'valid':69 'version':44,59 'year':64","created_at":"2026-04-09T04:02:25.455000+00:00","updated_at":"2026-04-16T23:59:50.018424+00:00","problems":[{"fix":"pip install uritools","cause":"The `uritools` library is not installed in the current Python environment.","error":"ModuleNotFoundError: No module named 'uritools'"},{"fix":"To access structured authority components like hostname, use `uritools.URI(uri_string).hostname` or `uritools.URI(uri_string).authority.hostname`.","cause":"The `uritools.urisplit` function returns a `SplitResult` named tuple, which provides `authority` as a string. Direct attributes like `hostname` or `port` are not part of `SplitResult`; they are parsed and available when using the `uritools.URI` object.","error":"AttributeError: 'SplitResult' object has no attribute 'hostname'"},{"fix":"Path parameters must be parsed directly from the `path` component of the `SplitResult`, or consider using `urllib.parse.urlparse` if its behavior for path parameters is preferred.","cause":"The `uritools.urisplit` function returns a `SplitResult` named tuple that does not have a `params` attribute. Unlike `urllib.parse.urlparse`, `uritools` treats path parameters (e.g., `;param=value`) as part of the `path` component rather than a separate field.","error":"AttributeError: 'SplitResult' object has no attribute 'params'"},{"fix":"Ensure the URI string has a valid scheme (e.g., 'http://example.com', 'ftp://server.org', 'urn:example:book').","cause":"The URI scheme component provided does not conform to RFC 3986 specifications, which require schemes to start with a letter and consist of letters, digits, '+', '-', or '.'.","error":"ValueError: Invalid scheme: 'invalid_scheme_example'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"6.1.3","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/tkem/uritools","docs":"https://uritools.readthedocs.io/en/stable/","changelog":"https://github.com/tkem/uritools/blob/master/CHANGELOG.rst","pypi":"https://pypi.org/project/uritools/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["http-networking","serialization"],"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}}