Skip to main content

Install

Download the python SDK using pip.
pip install superleap

Quickstart

Acquire API Key

Before starting, you will need a valid API key from your Superleap Account, make sure to attach the necessary permissions to the key

Initialize SuperleapClient

In your python project, import superleap.client initialize a client with the right Environment and API KEY. Example can be found under the init.py file below.

Add Object

To poll data for a specific Object, use .add_object(Object("{your-object-slug}", Pointer("pointer_value",{int(pointer_timestamp)}))). Pointer can also be None, Superleap maintains the latest pointer of each object as and when commited. Example can be found under the poller.py file below.

Set Handler Function

The poller expects a handler function to be set in order to process the data that has been fetched from Superleap. A handler function must accept 3 arguments list[ObjectAuditData], mark_as_read_func, commit_func mark_as_read_func can be invoked by passing the object_pointer in order to mark that record as the latest acknowledged record. This marks the pointer for the corresponding object and fetches next set of values on the next fetch call to Superleap.
Calling mark_as_read_func does not ensure the pointer is maintained after the program restarts. In order to maintain statefulness of the pointer, please use commit_func before shutting down the client
from superleap.client import *

client = SuperleapClient(Environment.LOCAL,"your-api-key")

Development

To set up the development environment:
  1. Clone the repository
  2. Create a virtual environment
  3. Install development dependencies:
  pip install -e ".[dev]"