Skip to content

jollyroger182/pyjsonapi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)

About

A JSON:API implementation in Python.

Resources

License

Stars

1 star

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages