Skip to main content

Python 3 API wrapper for LeanPlum

Project description


A small python wrapper around Leanplum API (

Version Compatability

  • 0.5.x - Python 3
  • 0.4.x - Python 2


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

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


  • 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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python-leanplum-0.6.0.tar.gz (9.9 kB view hashes)

Uploaded source

Built Distribution

python_leanplum-0.6.0-py3-none-any.whl (12.0 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page