Skip to main content

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


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.post2.tar.gz (5.4 kB view hashes)

Uploaded Source

Built Distribution

jsonapi_python-0.1.1.post2-py3-none-any.whl (6.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page