update
This commit is contained in:
@@ -0,0 +1 @@
|
||||
pip
|
||||
@@ -0,0 +1,84 @@
|
||||
Metadata-Version: 2.4
|
||||
Name: uritemplate
|
||||
Version: 4.2.0
|
||||
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 OR Apache-2.0
|
||||
Project-URL: Source, https://github.com/python-hyper/uritemplate
|
||||
Keywords: rfc 6570 uri template
|
||||
Classifier: Development Status :: 5 - Production/Stable
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: Programming Language :: Python
|
||||
Classifier: Programming Language :: Python :: 3
|
||||
Classifier: Programming Language :: Python :: 3 :: Only
|
||||
Classifier: Programming Language :: Python :: Implementation :: CPython
|
||||
Requires-Python: >=3.9
|
||||
Description-Content-Type: text/x-rst
|
||||
License-File: LICENSE
|
||||
Dynamic: license-file
|
||||
|
||||
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,17 @@
|
||||
uritemplate-4.2.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
||||
uritemplate-4.2.0.dist-info/METADATA,sha256=NSr9Q7bxq4-UyjGvKhrU8NGpTb1xLBttnkTjXUuzqWI,2579
|
||||
uritemplate-4.2.0.dist-info/RECORD,,
|
||||
uritemplate-4.2.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
||||
uritemplate-4.2.0.dist-info/licenses/LICENSE,sha256=PPyfAc3uySkA8ijPVnf_pX5-0wTEJjUyvK2cvZlp5Gw,196
|
||||
uritemplate-4.2.0.dist-info/top_level.txt,sha256=WJzkFEINWbgwuzuUEP8kD8Sk2fFHYQzBgrjO3viyubE,12
|
||||
uritemplate/__init__.py,sha256=4VPKNovvYqtf2-NWMfoW_L5LdkgZph0FAJdJXLktv5U,876
|
||||
uritemplate/__pycache__/__init__.cpython-312.pyc,,
|
||||
uritemplate/__pycache__/api.cpython-312.pyc,,
|
||||
uritemplate/__pycache__/orderedset.cpython-312.pyc,,
|
||||
uritemplate/__pycache__/template.cpython-312.pyc,,
|
||||
uritemplate/__pycache__/variable.cpython-312.pyc,,
|
||||
uritemplate/api.py,sha256=I_tFOvrvUPfmLGfvb4CDyeZb2DhqGQ8oEeTAT-jEO5s,2306
|
||||
uritemplate/orderedset.py,sha256=4Z8u8uw339D_RWvbUslv5d6EnA2wxQC66317oTLzp0o,3367
|
||||
uritemplate/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
uritemplate/template.py,sha256=7upfALQ2yBXxE8ipKqx3g0P7TgMRQRItXRoaG5doLnk,4774
|
||||
uritemplate/variable.py,sha256=ZwmTFlqQRvp9Td9FSbP4Co9n1lUefZY17_K_jv1lTBY,18291
|
||||
@@ -0,0 +1,5 @@
|
||||
Wheel-Version: 1.0
|
||||
Generator: setuptools (80.9.0)
|
||||
Root-Is-Purelib: true
|
||||
Tag: py3-none-any
|
||||
|
||||
@@ -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 @@
|
||||
uritemplate
|
||||
Reference in New Issue
Block a user