VOOZH about

URL: https://pypi.org/project/uritemplate/

⇱ uritemplate Β· PyPI


Skip to main content

uritemplate 4.2.0

pip install uritemplate

Latest release

Released:

Implementation of RFC 6570 URI Templates

Navigation

Unverified details

These details have not been verified by PyPI
Project links
Meta
  • License: BSD 3-Clause OR Apache-2.0
  • Author: Ian Stapleton Cordasco
  • Tags rfc , 6570 , uri , template
  • Requires: Python >=3.9

Project description

Documentation – GitHub – Travis-CI

Simple python library to deal with URI Templates. The API looks like

fromuritemplateimport URITemplate, expand# NOTE: URI params must be strings not integersgist_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# orprint(expand(gist_uri, gist_id='123456'))# alsot.expand({'gist_id': '123456'})print(expand(gist_uri, {'gist_id': '123456'}))

Where it might be useful to have a class

importrequestsclassGitHubUser(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

Project details

Unverified details

These details have not been verified by PyPI
Project links
Meta
  • License: BSD 3-Clause OR Apache-2.0
  • Author: Ian Stapleton Cordasco
  • Tags rfc , 6570 , uri , template
  • Requires: Python >=3.9

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

uritemplate-4.2.0.tar.gz (33.3 kB view details)

Uploaded Source

Built Distribution

Filter files by name, interpreter, ABI, and platform.

If you're not sure about the file name format, learn more about wheel file names.

Copy a direct link to the current filters

uritemplate-4.2.0-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file uritemplate-4.2.0.tar.gz.

File metadata

  • Download URL: uritemplate-4.2.0.tar.gz
  • Upload date:
  • Size: 33.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for uritemplate-4.2.0.tar.gz
Algorithm Hash digest
SHA256 480c2ed180878955863323eea31b0ede668795de182617fef9c6ca09e6ec9d0e
MD5 c1b679033e9be398232e75ad9e09e8e8
BLAKE2b-256 9860f174043244c5306c9988380d2cb10009f91563fc4b31293d27e17201af56

See more details on using hashes here.

Provenance

The following attestation bundles were made for uritemplate-4.2.0.tar.gz:

Publisher: release.yml on python-hyper/uritemplate

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file uritemplate-4.2.0-py3-none-any.whl.

File metadata

  • Download URL: uritemplate-4.2.0-py3-none-any.whl
  • Upload date:
  • Size: 11.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for uritemplate-4.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 962201ba1c4edcab02e60f9a0d3821e82dfc5d2d6662a21abd533879bdb8a686
MD5 9de1bba5e7bffd8c77388ae3b62fee87
BLAKE2b-256 a9993ae339466c9183ea5b8ae87b34c0b897eda475d2aec2307cae60e5cd4f29

See more details on using hashes here.

Provenance

The following attestation bundles were made for uritemplate-4.2.0-py3-none-any.whl:

Publisher: release.yml on python-hyper/uritemplate

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

πŸ‘ Image
AWS Cloud computing and Security Sponsor πŸ‘ Image
Datadog Monitoring πŸ‘ Image
Depot Continuous Integration πŸ‘ Image
Fastly CDN πŸ‘ Image
Google Download Analytics πŸ‘ Image
Pingdom Monitoring πŸ‘ Image
Sentry Error logging πŸ‘ Image
StatusPage Status page