{"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":"en","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,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}