Python 3 API wrapper for LeanPlum
Project description
python-leanplum
A small python wrapper around Leanplum API (https://docs.leanplum.com/reference#api-introduction)
Version Compatability
- 0.5.x - Python 3
- 0.4.x - Python 2
Usage
from leanplum.client import Client
client = Client(app_id="your_app_id", client_key="your_client_key")
# track events
client.users.track(1234, "custom event")
# advance state
client.users.advance(1234, "Registered")
# set user attributes
client.users.set_user_attributes(1234, {"custom_param": "value"})
# increment attribute
client.users.increment_user_attribute(1234, "Page Views", incr=1)
# delete user
client.admin.delete_user(1234)
This wrapper uses the python-requests library. Currently, we don't have a need to support other network clients, but if we do they will be added as a new ClientImpl(HttpClient). (see leanplum.http_client)
The return object right now is a requests.Response.body, which is a String. If your request has errors or warnings, some common ones are raised after the response, and you can see some of them at leanplum.errors
By default, POST requests that handle user behaviors are marked with createDisposition=CreateNever
. This may be
modified or made configurable in a later version
TODO:
- requestor better handling of the request (multiple/batch responses? Right now hard coded to get response[0])
- Response objects for Message, User, State, Event (current return object is a dict)
- More precise Errors to match with Leanplum's wrapped responses
- Add support for croKey and cwoKey, maybe dev/prod mode?
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for python_leanplum-0.6.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef1515ffeeb124357bbc97ba7005b207313ffea984a8853d77f9cb2389221696 |
|
MD5 | 39ccb173999a5ca6c3473e90ea9c5680 |
|
BLAKE2b-256 | 94af584a569b43115925e9e881051b387cbe1b4808d008071579f6a1b04c3d18 |