All Projects → python-hyper → Uritemplate

python-hyper / Uritemplate

Licence: other
URI template parsing per RFC6570

Programming Languages

python
139335 projects - #7 most used programming language

Labels

Projects that are alternatives of or similar to Uritemplate

Uri
🌏 Functions for making sense out of URIs in PHP
Stars: ✭ 259 (+37.77%)
Mutual labels:  uri
Bidi
Bidirectional URI routing
Stars: ✭ 941 (+400.53%)
Mutual labels:  uri
Rdflib
RDFLib is a Python library for working with RDF, a simple yet powerful language for representing information.
Stars: ✭ 1,584 (+742.55%)
Mutual labels:  uri
Searchwithmybrowser
Open Cortana searches with your default browser.
Stars: ✭ 285 (+51.6%)
Mutual labels:  uri
Uri.js
Javascript URL mutation library
Stars: ✭ 6,119 (+3154.79%)
Mutual labels:  uri
Sttp
The Scala HTTP client you always wanted!
Stars: ✭ 1,078 (+473.4%)
Mutual labels:  uri
UrlCombine
C# util for combining Url paths. Works similarly to Path.Combine.
Stars: ✭ 23 (-87.77%)
Mutual labels:  uri
Tldts
JavaScript Library to work against complex domain names, subdomains and URIs.
Stars: ✭ 151 (-19.68%)
Mutual labels:  uri
Badges4 Readme.md Profile
👩‍💻👨‍💻 Improve your README.md profile with these amazing badges.
Stars: ✭ 929 (+394.15%)
Mutual labels:  uri
Addressable
Addressable is an alternative implementation to the URI implementation that is part of Ruby's standard library. It is flexible, offers heuristic parsing, and additionally provides extensive support for IRIs and URI templates.
Stars: ✭ 1,313 (+598.4%)
Mutual labels:  uri
Uri Parser
RFC3986/RFC3987 compliant URI parser
Stars: ✭ 342 (+81.91%)
Mutual labels:  uri
Uri
URI manipulation Library
Stars: ✭ 662 (+252.13%)
Mutual labels:  uri
Request via
RequestVia: A Functional HTTP Client That Wraps Net::HTTP
Stars: ✭ 74 (-60.64%)
Mutual labels:  uri
Android Nosql
Lightweight, simple structured NoSQL database for Android
Stars: ✭ 284 (+51.06%)
Mutual labels:  uri
Embiggen
A Ruby library to expand shortened URLs
Stars: ✭ 122 (-35.11%)
Mutual labels:  uri
httoop
HTTOOP - a fully object oriented HTTP protocol library written in python
Stars: ✭ 15 (-92.02%)
Mutual labels:  uri
Handle Path Oz
Android Library to handle multiple Uri's(paths) received through Intents.
Stars: ✭ 36 (-80.85%)
Mutual labels:  uri
Uriparser
🔪 Strictly RFC 3986 compliant URI parsing and handling library written in C89; moved from SourceForge to GitHub
Stars: ✭ 163 (-13.3%)
Mutual labels:  uri
React Native Wormhole
⚛️ 🌌 Inter-dimensional Portals for React Native. 👽 🖖
Stars: ✭ 133 (-29.26%)
Mutual labels:  uri
Iri
Simple Immutable URI/URL Builder in Ruby
Stars: ✭ 90 (-52.13%)
Mutual labels:  uri

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: http://tools.ietf.org/html/rfc6570 .. _license: https://github.com/python-hyper/uritemplate/blob/master/LICENSE

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].