Install & Compatibility
Where this runs
tested against v3.0.0 · 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
muslpy 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 19.7MB
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 1.7s · import 0.000s · 19MB
17MB installed
● package 17MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
URL
✓ from can_ada import URL
✗ import can_ada.URL
URL is a class directly exposed at the top level of the package.
parse_url
✓ from can_ada import parse_url
✗ import can_ada.parse_url
parse_url is a utility function exposed at the top level of the package.
URLSearchParams
✓ from can_ada import URLSearchParams
✗ import can_ada.URLSearchParams
URLSearchParams is a class for working with URL query parameters.
Demonstrates basic URL parsing, accessing components, and modification using the URL object, as well as the convenience function `parse_url`.
from can_ada import URL, parse_url
# Parse a URL string into a URL object
url_string = "https://example.com:8080/path/to/resource?query=value&foo=bar#fragment"
url_object = URL(url_string)
print(f"Original URL: {url_object.href}")
print(f"Protocol: {url_object.protocol}") # e.g., 'https:'
print(f"Host: {url_object.host}") # e.g., 'example.com:8080'
print(f"Hostname: {url_object.hostname}") # e.g., 'example.com'
print(f"Port: {url_object.port}") # e.g., '8080'
print(f"Pathname: {url_object.pathname}") # e.g., '/path/to/resource'
print(f"Search: {url_object.search}") # e.g., '?query=value&foo=bar'
print(f"Hash: {url_object.hash}") # e.g., '#fragment'
# Modify parts of the URL
url_object.hostname = "newhost.org"
url_object.pathname = "/new/path"
print(f"Modified URL: {url_object.href}")
# Using parse_url for convenience (returns a dictionary-like object)
parsed_dict = parse_url("http://test.com/page")
print(f"Parsed dict protocol: {parsed_dict.protocol}")
Errors
Common errors & fixes
ImportError: cannot import name 'URL' from 'can_ada'
Attempting to import `URL` (or other symbols) from `can_ada` directly as an attribute, or a typo in the import path.
fixEnsure you are using `from can_ada import URL` (or `parse_url`, `URLSearchParams`) as these are top-level exports.
ValueError: Invalid URL
The input string provided to the `URL` constructor or `parse_url` function does not conform to the WHATWG URL standard.
fixVerify that the URL string is correctly formatted (e.g., includes a scheme like 'http://', valid characters, etc.).
AttributeError: 'URL' object has no attribute 'domain'
Attempting to access a non-existent URL component. `can-ada` adheres to the WHATWG URL Standard, which uses `hostname` or `host` instead of `domain`.
fixUse `url_object.hostname` for the domain without port, or `url_object.host` for the domain with port (if present).
TypeError: argument 'base_input': 'NoneType' object cannot be converted to 'str'
Passing `None` as the `base_input` argument to the `URL` constructor when it expects a string for URL resolution.
fixEnsure `base_input` is always a string when provided, or omit it if no base URL is required.
Upgrade
Version history
3.0.0latest on PyPI · released Jan 28, 2026
Audit
Dependencies
No dependency data recorded yet.