1 # Buildsheet autogenerated by ravenadm tool -- Do not edit.
3 NAMEBASE= python-uritemplate
7 SDESC[py310]= Implementation of RFC 6570 URI Templates (3.10)
8 SDESC[py39]= Implementation of RFC 6570 URI Templates (3.9)
9 HOMEPAGE= https://uritemplate.readthedocs.org
10 CONTACT= Python_Automaton[python@ironwolf.systems]
13 SITES[main]= PYPIWHL/81/c0/7461b49cd25aeece13766f02ee576d1db528f1c37ce69aee300e075b485b
14 DISTFILE[1]= uritemplate-4.1.1-py2.py3-none-any.whl:main
19 OPTIONS_AVAILABLE= PY39 PY310
20 OPTIONS_STANDARD= none
21 VOPTS[py310]= PY39=OFF PY310=ON
22 VOPTS[py39]= PY39=ON PY310=OFF
24 DISTNAME= uritemplate-4.1.1.dist-info
28 [PY39].USES_ON= python:py39,wheel
30 [PY310].USES_ON= python:py310,wheel
32 [FILE:1793:descriptions/desc.single]
36 Documentation_ -- GitHub_ -- Travis-CI_
38 Simple python library to deal with `URI Templates`_. The API looks like
40 .. code-block:: python
42 from uritemplate import URITemplate, expand
44 # NOTE: URI params must be strings not integers
46 gist_uri = 'https://api.github.com/users/sigmavirus24/gists{/gist_id}'
47 t = URITemplate(gist_uri)
48 print(t.expand(gist_id='123456'))
49 # => https://api.github.com/users/sigmavirus24/gists/123456
52 print(expand(gist_uri, gist_id='123456'))
55 t.expand({'gist_id': '123456'})
56 print(expand(gist_uri, {'gist_id': '123456'}))
58 Where it might be useful to have a class
60 .. code-block:: python
64 class GitHubUser(object):
65 url = URITemplate('https://api.github.com/user{/login}')
66 def __init__(self, name):
67 self.api_url = url.expand(login=name)
68 response = requests.get(self.api_url)
69 if response.status_code == 200:
70 self.__dict__.update(response.json())
72 When the module containing this class is loaded, ``GitHubUser.url`` is
73 evaluated and so the template is created once. It's often hard to notice in
74 Python, but object creation can consume a great deal of time and so can the
75 re module which uritemplate relies on. Constructing the object once should
76 reduce the amount of time your code takes to run.
83 pip install uritemplate
90 .. _Documentation: https://uritemplate.readthedocs.io/
91 .. _GitHub: https://github.com/python-hyper/uritemplate
92 .. _Travis-CI: https://travis-ci.org/python-hyper/uritemplate
93 .. _URI Templates: https://tools.ietf.org/html/rfc6570
95 https://github.com/python-hyper/uritemplate/blob/master/LICENSE
99 830c08b8d99bdd312ea4ead05994a38e8936266f84b9a7878232db50b044e02e 10356 uritemplate-4.1.1-py2.py3-none-any.whl