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
jsonapi_python-0.1.1.tar.gz
(5.3 kB
view hashes)
Built Distribution
Close
Hashes for jsonapi_python-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 96f150cbab7aec6407e79fbcc8499fdddeeedcb0e926ef5036d1e6275b164c2f |
|
MD5 | f41d43f783e404d17f1c145f36efd278 |
|
BLAKE2b-256 | 608bcd64d0f5a9e2d006d87fb6421fd1c0ac69d90efacd4482934f0e7f85d2fe |