AmpliPython

AmpliPython is lightweight Amplitude Integration for event logging


License
MIT
Install
pip install AmpliPython==1.2.1

Documentation

AmpliPython

PyPI version GitHub stars

AmpliPython is a Python library which provides an easy method to log your events with Amplitude Analytics.
Built with Pydantic.

Installing

You can install this using pip.

$ pip install AmpliPython

Quick Start

Usage is pretty easy, just pass all the params you want to AmplipyEvent and then log it with AmplipyClient

from amplipython import AmplipyClient, AmplipyEvent

client = AmplipyClient(api_key="YOUR_API_KEY")

# Single event example, no additional data provided
event = AmplipyEvent(user_id="sample", event_type="amplipy-sample")
client.log_event(event)

# Multiple events example with event and user data
event_list = []
for i in range(5):
    event = AmplipyEvent(
        user_id="sample",
        event_type="amplipy-sample",
        event_properties={"iteration": i},
        user_properties={"sent_by": "amplipy"},
    )
    event_list.append(event)

# NOTE: Events order is dashboard is not specified!
client.log_events(event_list)

See all params you can pass to AmplipyEvent instance

Exceptions

When trying to log event, following exceptions could be raised:

  • AmplipyInvalidRequestError

  • AmplipyPayloadTooLargeError

  • AmplipyTooManyRequestsForDeviceError

  • AmplipyAmplitudeServerError

  • AmplipyAmplitudeIsUnavaliable

Event Params

All keys for AmplipyEvent initializer could be found in official Amplitude docs:
https://developers.amplitude.com/docs/http-api-v2


PRs are pretty much welcomed and highly appreciated! 👻