Registry / http-networking / uritools

uritools

JSON →
library6.1.3pypypi✓ verified 27d ago

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 uritools
INSTALL
IMPORT
SIG · URITOOLS
U
uritools
http-networkingpythonv6.1.3
Install
1.5s avg
Import
14ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v6.1.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.012s · 17.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.5s · import 0.016s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

urisplit
from uritools import urisplit
from uritools import splituri
`splituri` was deprecated in v4.x and removed in v5.0.0. Use `urisplit` for parsing.
uricompose
from uritools import uricompose
from uritools import composeuri
`composeuri` was deprecated in v4.x and removed in v5.0.0. Use `uricompose` for re-assembling URIs.
urirecompose
from uritools import urirecompose
uricomponent
from uritools import uricomponent
A utility class for working with URI components.

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.

from uritools import urisplit, uricompose # Parse a URI into its components uri_string = 'https://user:pass@www.example.com:8080/foo/bar?q=baz&x=y#frag' p = urisplit(uri_string) print(f"Scheme: {p.scheme}") print(f"Userinfo: {p.userinfo}") print(f"Host: {p.host}") print(f"Port: {p.port}") print(f"Path: {p.path}") print(f"Query: {p.query}") print(f"Fragment: {p.fragment}") # Recompose the URI from its components recomposed_uri = uricompose(p) print(f"Recomposed URI: {recomposed_uri}") # Example of getting query parameters print(f"Query parameters: {p.get_query_dict()}")
Debug
Known issues
breakingStarting with version 6.0.0, `uritools` requires Python 3.10 or newer. Installing on older Python versions will fail.
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`).
affects: 6.0.0+
breakingThe functions `splituri` and `composeuri` were removed in version 5.0.0. They were deprecated in version 4.x in favor of `urisplit` and `uricompose`.
fix
Update your code to use `uritools.urisplit` for parsing and `uritools.uricompose` for composing URIs.
affects: 5.0.0+
gotcha`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.
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).
affects: All
gotchaThe `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.
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.
affects: All
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'uritools'
The `uritools` library is not installed in the current Python environment.
fix
pip install uritools
AttributeError: 'SplitResult' object has no attribute 'hostname'
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.
fix
To access structured authority components like hostname, use `uritools.URI(uri_string).hostname` or `uritools.URI(uri_string).authority.hostname`.
AttributeError: 'SplitResult' object has no attribute 'params'
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.
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.
ValueError: Invalid scheme: 'invalid_scheme_example'
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 '.'.
fix
Ensure the URI string has a valid scheme (e.g., 'http://example.com', 'ftp://server.org', 'urn:example:book').
Upgrade
Version history
6.1.3latest on PyPI · released Jul 23, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
39 hits · last 30 days
node
34
Amazon
1
OpenAI (training)
1
Resources
uritools — pip install uritools · libregistry