--- id: uritemplate version: "4.2.0" license: BSD 3-Clause OR Apache-2.0 license_treatment: permissive maintenance: active --- # uritemplate — Implementation of RFC 6570 URI Templates License: permissive · Maintenance: active · Popularity: top 1,000 on PyPI ## Install pip install uritemplate uv add uritemplate poetry add uritemplate ## Description uritemplate =========== Documentation_ -- GitHub_ -- Travis-CI_ Simple python library to deal with `URI Templates`_. The API looks like .. code-block:: python from uritemplate import URITemplate, expand # NOTE: URI params must be strings not integers gist_uri = 'https://api.github.com/users/sigmavirus24/gists{/gist_id}' t = URITemplate(gist_uri) print(t.expand(gist_id='123456')) # => https://api.github.com/users/sigmavirus24/gists/123456 # or print(expand(gist_uri, gist_id='123456')) # also t.expand({'gist_id': '123456'}) print(expand(gist_uri, {'gist_id': '123456'})) Where it might be useful to have a class .. code-block:: python import requests class GitHubUser(object): url = URITemplate('https://api.github.com/user{/login}') def __init__(self, name): self.api_url = url.expand(login=name) response = requests.get(self.api_url) if response.status_code == 200: self.__dict__.update(response.json()) When the module containing this class is loaded, ``GitHubUser.url`` is evaluated and so the template is created once. It's often hard to notice... ## AI interpretation — verify before relying Expands RFC 6570 URI templates by substituting variables into template expressions, useful for constructing dynamic URLs in API clients and web applications. Verdict: Production-ready RFC 6570 implementation with no dependencies, active maintenance, permissive licensing, and zero known vulnerabilities. Well-suited for API client libraries and URL templating tasks. [View on SkillFed](https://skillfed.io/packages/uritemplate) · [View on PyPI](https://pypi.org/project/uritemplate/)