2025-12-01

This commit is contained in:
2026-03-17 14:58:51 -06:00
parent 183e865f8b
commit 4b82b57113
6846 changed files with 954887 additions and 162606 deletions
@@ -0,0 +1,3 @@
This software is made available under the terms of *either* of the licenses
found in LICENSE.APACHE or LICENSE.BSD. Contributions to uritemplate are
made under the terms of *both* these licenses.
@@ -0,0 +1,92 @@
Metadata-Version: 2.1
Name: uritemplate
Version: 4.1.1
Summary: Implementation of RFC 6570 URI Templates
Home-page: https://uritemplate.readthedocs.org
Author: Ian Stapleton Cordasco
Author-email: graffatcolmingov@gmail.com
License: BSD 3-Clause License or Apache License, Version 2.0
Keywords: rfc 6570 uri template
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved
Classifier: License :: OSI Approved :: Apache Software License
Classifier: License :: OSI Approved :: BSD License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: Implementation :: CPython
Requires-Python: >=3.6
Description-Content-Type: text/x-rst
License-File: LICENSE
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 in
Python, but object creation can consume a great deal of time and so can the
``re`` module which uritemplate relies on. Constructing the object once should
reduce the amount of time your code takes to run.
Installing
----------
::
pip install uritemplate
License
-------
Modified BSD license_
.. _Documentation: https://uritemplate.readthedocs.io/
.. _GitHub: https://github.com/python-hyper/uritemplate
.. _Travis-CI: https://travis-ci.org/python-hyper/uritemplate
.. _URI Templates: https://tools.ietf.org/html/rfc6570
.. _license: https://github.com/python-hyper/uritemplate/blob/master/LICENSE
@@ -0,0 +1,11 @@
uritemplate/__init__.py,sha256=toWdtJeaNWsftVzhDASD_2wwxkd84HdXg22rFwMkVkc,816
uritemplate/api.py,sha256=eQ3DdgNNDlnoedSE-rQ5AQv8JvMzdljPX8l-187myfI,2305
uritemplate/orderedset.py,sha256=4Z8u8uw339D_RWvbUslv5d6EnA2wxQC66317oTLzp0o,3367
uritemplate/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
uritemplate/template.py,sha256=qXcNZxcGPGxgQnaRDIafaKsrTnvBzplOBBPAM8Hbq7g,4774
uritemplate/variable.py,sha256=HixfLuF7R3f7zwIQohB9cFVRVZsN_8Y2RIZDRHpNg40,12870
uritemplate-4.1.1.dist-info/LICENSE,sha256=PPyfAc3uySkA8ijPVnf_pX5-0wTEJjUyvK2cvZlp5Gw,196
uritemplate-4.1.1.dist-info/METADATA,sha256=rotEEWL5rUie3gKyYHhxXqjdpYw16kLCT0Aw0bvta9o,2882
uritemplate-4.1.1.dist-info/WHEEL,sha256=WzZ8cwjh8l0jtULNjYq1Hpr-WCqCRgPr--TX4P5I1Wo,110
uritemplate-4.1.1.dist-info/top_level.txt,sha256=WJzkFEINWbgwuzuUEP8kD8Sk2fFHYQzBgrjO3viyubE,12
uritemplate-4.1.1.dist-info/RECORD,,
@@ -0,0 +1,6 @@
Wheel-Version: 1.0
Generator: bdist_wheel (0.37.0)
Root-Is-Purelib: true
Tag: py2-none-any
Tag: py3-none-any