Install
Download the python SDK using pip.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 keyInitialize SuperleapClient
In your python project, import superleap.client initialize a client with the right Environment and API KEY. Example can be found under theinit.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 argumentslist[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.
Development
To set up the development environment:- Clone the repository
- Create a virtual environment
- Install development dependencies: