Skip to main content

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


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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

Details for the file python-leanplum-0.6.0.tar.gz.

File metadata

  • Download URL: python-leanplum-0.6.0.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.5

File hashes

Hashes for python-leanplum-0.6.0.tar.gz
Algorithm Hash digest
SHA256 87a7af16d258886112de5b28f781e21f8c90b62282b1fc2b4ca715b39efbcf4e
MD5 3417104df3180d1b72bfb6cff1615741
BLAKE2b-256 87646881db0b3ff1b05d6a0f4bc3cf7cba52f81f08d3c0bce6741e72f8092d0d

See more details on using hashes here.

File details

Details for the file python_leanplum-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: python_leanplum-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 12.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.5

File hashes

Hashes for python_leanplum-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ef1515ffeeb124357bbc97ba7005b207313ffea984a8853d77f9cb2389221696
MD5 39ccb173999a5ca6c3473e90ea9c5680
BLAKE2b-256 94af584a569b43115925e9e881051b387cbe1b4808d008071579f6a1b04c3d18

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page