jsonapi-python 0.1.1.post2

Creator: bradpython12

Last updated:

Add to Cart

Description:

jsonapipython 0.1.1.post2

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)

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.