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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file jsonapi_python-0.1.1.post2.tar.gz.

File metadata

  • Download URL: jsonapi_python-0.1.1.post2.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.6 Linux/6.5.0-27-generic

File hashes

Hashes for jsonapi_python-0.1.1.post2.tar.gz
Algorithm Hash digest
SHA256 aa702ca8b1e455d05ce553db583b7e816ce2f5c4190833e6c6296d61fbaff40e
MD5 cbd6ab1bf7089f42a2993f3863d10477
BLAKE2b-256 d3e88a94efdc9895d65baca6a99217e6e3b1c1cca75b5c20f34b6460baeb7070

See more details on using hashes here.

File details

Details for the file jsonapi_python-0.1.1.post2-py3-none-any.whl.

File metadata

File hashes

Hashes for jsonapi_python-0.1.1.post2-py3-none-any.whl
Algorithm Hash digest
SHA256 bf8ce63a2074923ef76b579d84422650f343acd5ddb69917923c13d11c5774fd
MD5 bab2c54c0f5a88d2af1b30575966f189
BLAKE2b-256 1baafc67baa1fe02a80c144a5b473d5c1f8176d0ea4a01430da7b598c37805a5

See more details on using hashes here.

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