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.post1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a69ae71cae27b2c3c87c293de6945830194ce8870c42a2bb6089f5ffbe5b488a |
|
MD5 | 53b3d2ce7902caa35f9bc90193a1d365 |
|
BLAKE2b-256 | de19467943a51b0ab5e9473392c8129799728259e85df10bcd6c705b187a1469 |
Close
Hashes for jsonapi_python-0.1.1.post1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ae5120696a1273e72caba13e27e365b95ddc26cb6f64b6fabd77a5eebc4d78a |
|
MD5 | 2406fbbb87871a305a4190d10e905f74 |
|
BLAKE2b-256 | 09a9860a3ec9721aed91f717bdcf6ff490e02680db850ebcae776e54a66d2f3e |