uritemplate
raw JSON → 4.2.0 verified Tue May 12 auth: no python install: verified quickstart: verified
A Python library for implementing RFC 6570 URI Templates, currently at version 4.2.0, with a release cadence of approximately every 1-2 years.
pip install uritemplate Common errors
error ModuleNotFoundError: No module named 'uritemplate' ↓
cause The 'uritemplate' library is not installed in the current Python environment.
fix
pip install uritemplate
error TypeError: expand() missing 1 required positional argument: 'var_dict' ↓
cause The `expand` method of a URITemplate object was called without the required dictionary of variables or with a non-dictionary positional argument.
fix
template.expand({'variable': 'value'})
error TypeError: argument of type 'NoneType' is not iterable ↓
cause The `expand` method was called with `None` as the argument for variables, which is not an iterable type like a dictionary.
fix
template.expand({'variable': 'value'})
error Missing '}' in URI template segment '{foo' ↓
cause The URI template string contains a syntax error, such as a missing closing brace or an invalid expression, violating RFC 6570.
fix
template = uritemplate.URITemplate('/path/{foo}')
Warnings
breaking Direct import of 'expand' and 'URITemplate' from 'uritemplate' module is required; previous import paths may be deprecated. ↓
fix Update import statements to 'from uritemplate import expand' and 'from uritemplate import URITemplate'.
gotcha Passing values by both 'var_dict' and 'kwargs' in 'expand' function may override values in 'var_dict'. ↓
fix Ensure consistency between 'var_dict' and 'kwargs' to avoid unintentional overrides.
Install compatibility verified last tested: 2026-05-12
python os / libc status wheel install import disk
3.10 alpine (musl) - - 0.02s 17.9M
3.10 slim (glibc) - - 0.01s 18M
3.11 alpine (musl) - - 0.04s 19.7M
3.11 slim (glibc) - - 0.03s 20M
3.12 alpine (musl) - - 0.03s 11.6M
3.12 slim (glibc) - - 0.03s 12M
3.13 alpine (musl) - - 0.03s 11.2M
3.13 slim (glibc) - - 0.03s 12M
3.9 alpine (musl) - - 0.02s 17.4M
3.9 slim (glibc) - - 0.02s 18M
Imports
- expand
from uritemplate import expand - URITemplate
from uritemplate import URITemplate
Quickstart verified last tested: 2026-04-23
from uritemplate import expand
uri = 'https://api.github.com{/user}'
expanded_uri = expand(uri, user='sigmavirus24')
print(expanded_uri)