jsonhome
Helpers for handling jsonhome documents
Free software: Apache license
Documentation: https://readthedocs.org/projects/jsonhome
Introduction
The jsonhome library provides a simple way to build and consume compliant json-home documents.
Building
To build a jsonhome document you create a document and then add resources:
>>> import jsonhome
>>> doc = jsonhome.Document()
>>> doc.add_resource('http://mysite.com/rel/widgets',
... uri='/widgets{/widget_id}'
... uri_vars={'widget_id': 'http://mysite.com/param/widget'},
... allow_get=True,
... accept_post=['application/json'])
>>> print(doc.to_json())
{
"resources": {
"http://mysite.com/rel/widgets": {
"href-template": "/widgets{/widget_id}",
"href-vars": {
"widget_id": "http://mysite.com/param/widget"
},
"hints": {
"accept-post": [
"application/json"
],
"allow": [
"GET",
"POST"
]
}
}
}
}
Additional parameters to creating resources can be found on the module documentation.
Consuming
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('http://mysite.com/rel/widgets', widget_id='1234')
'/widgets/1234'
Or for specific information you can find helpers on the resource:
>>> print(doc['http://mysite.com/rel/widgets'].href_vars)
{"widget_id": "http://mysite.com/param/widget"}
Metadata
Release files for jsonhome 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| jsonhome-0.1.0.tar.gz | 15.7 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| jsonhome-0.1.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 28.6 kB
Release files / jsonhome-0.1.0.tar.gz
| Download URL | jsonhome-0.1.0.tar.gz |
|---|---|
| Size | 15.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d0c2e04fd77a176acb7587b49a6275f75bee73d44f717690f39f2aa57f29f015
|
|
BLAKE2b-256 checksum How to use checksums |
5a3a76ba53800e514a9867df415460b38ef4b3f7ea7769f811fdcaa07d3c2faa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / jsonhome-0.1.0-py2.py3-none-any.whl
| Download URL | jsonhome-0.1.0-py2.py3-none-any.whl |
|---|---|
| Size | 12.9 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
36201a336ad96f6f07c44fb375c327176d8e0e2b5d35be145ba3c83cd564b9c5
|
|
BLAKE2b-256 checksum How to use checksums |
1f08737cc043fbd4b7e6d212474deb374edc80b0f60bd9ff343cc24dcfa02e27
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for jsonhome 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.