Python JSON:API implementation
Project description
pyjsonapi
A JSON:API implementation in Python.
Usage
from pyjsonapi import Model, ToManyRelationship, Session
class Student(Model, type='student'):
name: str
age: int
classrooms: ToManyRelationship['Classroom']
class Classroom(Model, type='classroom'):
name: str
students: ToManyRelationship[Student]
session = Session('http://example.com/api')
student = session.fetch(Student, 'id-of-student')
print(student.name, 'age', student.age)
classrooms = student.classrooms.items
print('classrooms:')
for classroom in classrooms:
print(classroom.name)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for jsonapi_python-0.1.1.post2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa702ca8b1e455d05ce553db583b7e816ce2f5c4190833e6c6296d61fbaff40e |
|
MD5 | cbd6ab1bf7089f42a2993f3863d10477 |
|
BLAKE2b-256 | d3e88a94efdc9895d65baca6a99217e6e3b1c1cca75b5c20f34b6460baeb7070 |
Close
Hashes for jsonapi_python-0.1.1.post2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf8ce63a2074923ef76b579d84422650f343acd5ddb69917923c13d11c5774fd |
|
MD5 | bab2c54c0f5a88d2af1b30575966f189 |
|
BLAKE2b-256 | 1baafc67baa1fe02a80c144a5b473d5c1f8176d0ea4a01430da7b598c37805a5 |