Skip to main content

Helpers for handling jsonhome documents

Project description

Helpers for handling jsonhome documents


The jsonhome library provides a simple way to build and consume compliant json-home documents.


To build a jsonhome document you create a document and then add resources:

>>> import jsonhome

>>> doc = jsonhome.Document()

>>> doc.add_resource('',
...                  uri='/widgets{/widget_id}'
...                  uri_vars={'widget_id': ''},
...                  allow_get=True,
...                  accept_post=['application/json'])

>>> print(doc.to_json())
    "resources": {
        "": {
            "href-template": "/widgets{/widget_id}",
            "href-vars": {
                "widget_id": ""
            "hints": {
                "accept-post": [
                "allow": [

Additional parameters to creating resources can be found on the module documentation.


To consume a json-home document you load it and then fetch the URIs you need:

>>> doc = jsonhome.Document.from_json(data)

>>> print(doc.get_uri('', widget_id='1234')

Or for specific information you can find helpers on the resource:

>>> print(doc[''].href_vars)
{"widget_id": ""}

Project details

Download files

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

Files for jsonhome, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size jsonhome-0.1.0-py2.py3-none-any.whl (12.9 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size jsonhome-0.1.0.tar.gz (15.7 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page