Skip to content

Latest commit

 

History

History
43 lines (27 loc) · 828 Bytes

README.rst

File metadata and controls

43 lines (27 loc) · 828 Bytes

Django CoreAPI client

Wrapper around coreapi.Client for convenient usage in Django projects.

Usage

Define settings:

COREAPI_CLIENT = {
    'example_server': {
        'SCHEMA_URL': 'https://example.com/api/schema/',
        'AUTH_USERNAME': 'client-example',
        'AUTH_PASSWORD': 'password-example',
    },
}

Initialize client:

from django_coreapi_client import Client

client = Client('example_server')

Access API endpoints according to the schema, e.g.

users = client.api.users.list()
project = client.api.users.projects.read(id=7)
new_project = client.api.users.projects.create(name='xxx', user_id=3)

Et cetera.

Hope it's useful. 73!