Python Django

Follow these steps to implement Kable within your Python Django API.

Estimated completion: 10 minutes

Get the latest version or contribute at:


Flask vs Django

If you are not using Kable as an Authentication Provider, then it does not matter if you use the Flask or Django SDK. The only differences between these two libraries is in the way headers are read for authentication purposes in authenticate.

Install dependencies

First, install the Kable Python Django SDK using pip.

python3 -m pip install kable-python-django

Implement Kable

from django.http import JsonResponse
from kable_python_django import Kable

# Initialize Kable with fields found on your Company page in the dashboard
kable = Kable({
  'kable_client_id': '<YOUR_KABLE_CLIENT_ID>',
  'kable_client_secret': '<YOUR_KABLE_CLIENT_SECRET>',
  'base_url': '',
  'debug': True

def get_record():
    # record data from within your API
    kable.record("yourcompanyuser_1234567890", { "userId": "xyz123" })
    return JsonResponse({'message': 'Data has been recorded by Kable!'})

# for using Kable as an authentication provider
def get_authenticate():
    return JsonResponse({'message': 'This request has been authenticated and recorded by Kable!'})