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.
pip install uritoolsVerified import paths — ran on the pinned version, not inferred.
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.
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`).
Update your code to use `uritools.urisplit` for parsing and `uritools.uricompose` for composing URIs.
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).
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.
pip install uritools
To access structured authority components like hostname, use `uritools.URI(uri_string).hostname` or `uritools.URI(uri_string).authority.hostname`.
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.
Ensure the URI string has a valid scheme (e.g., 'http://example.com', 'ftp://server.org', 'urn:example:book').
No dependency data recorded yet.