uritemplate
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.
Warnings
- breaking Direct import of 'expand' and 'URITemplate' from 'uritemplate' module is required; previous import paths may be deprecated.
- gotcha Passing values by both 'var_dict' and 'kwargs' in 'expand' function may override values in 'var_dict'.
Install
-
pip install uritemplate
Imports
- expand
from uritemplate import expand
- URITemplate
from uritemplate import URITemplate
Quickstart
from uritemplate import expand
uri = 'https://api.github.com{/user}'
expanded_uri = expand(uri, user='sigmavirus24')
print(expanded_uri)