Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add version_name to EventOptions #31

Merged
merged 1 commit into from
Jul 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
<p align="center">
<a href="https://amplitude.com" target="_blank" align="center">
<img src="https://static.amplitude.com/lightning/46c85bfd91905de8047f1ee65c7c93d6fa9ee6ea/static/media/amplitude-logo-with-text.4fb9e463.svg" width="280">
</a>
<br />
</p>

# Amplitude Python SDK

[![PyPI version](https://badge.fury.io/py/amplitude-analytics.svg)](https://badge.fury.io/py/amplitude-analytics)

The official Amplitude backend Python SDK for server-side instrumentation.

## Amplitude and Ampli Wrapper
[Ampli SDK](https://www.docs.developers.amplitude.com/data/ampli/) is autogenerated library based on your pre-defined [tracking plan](https://developers.data.amplitude.com/what-is-a-tracking-plan). The Ampli Wrapper, is a lightweight wrapper over the Amplitude SDK that provides type-safety, supports linting, and enables features like input validation. The code replicates the spec in the Tracking Plan and enforces its rules and requirements. This repository is about **Amplitude SDK**. To learn more about Ampli Wrapper, please refer to the [Ampli Python](https://www.docs.developers.amplitude.com/data/sdks/python-ampli/) and [examples](https://github.com/amplitude/ampli-examples).

## Installation and Quick Start
Please visit the [Developer Center](https://developers.amplitude.com/docs/python-beta) for instructions on installing and using our the SDK.
Please visit the [Developer Center](https://docs.developers.amplitude.com/data/sdks/python/) for instructions on installing and using our the SDK.

## Changelog
View the [releases here](https://github.com/amplitude/Amplitude-Python/releases).
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@
project_urls={
"Bug Reports": "https://github.com/amplitude/Amplitude-Python/issues",
"Source": "https://github.com/amplitude/Amplitude-Python",
"Developer Doc": "https://developers.amplitude.com/docs/python-beta"
"Developer Doc": "https://docs.developers.amplitude.com/data/sdks/python/"
},
)
7 changes: 6 additions & 1 deletion src/amplitude/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ def get_plan_body(self):
"library": ["library", str],
"plan": ["plan", Plan],
"group_properties": ["group_properties", dict],
"partner_id": ["partner_id", str]
"partner_id": ["partner_id", str],
"version_name": ["version_name", str]
}


Expand Down Expand Up @@ -158,6 +159,7 @@ class EventOptions:
we have already seen before within the past 7 days will be deduplicated.
plan (Plan, optional): Tracking plan properties.
partner_id (str, optional): The partner id.
version_name (str, optional): The version name.
callback (callable, optional): Event level callback method. Triggered when event is sent or failed. Take three
parameters: an event instance, an integer code of response status, an optional string message.

Expand Down Expand Up @@ -202,6 +204,7 @@ def __init__(self, user_id: Optional[str] = None,
insert_id: Optional[str] = None,
plan: Optional[Plan] = None,
partner_id: Optional[str] = None,
version_name: Optional[str] = None,
callback=None):
"""The constructor of EventOptions class"""
self.user_id: Optional[str] = None
Expand Down Expand Up @@ -238,6 +241,7 @@ def __init__(self, user_id: Optional[str] = None,
self.library: Optional[str] = None
self.plan: Optional[Plan] = None
self.partner_id: Optional[str] = None
self.version_name: Optional[str] = None
self["user_id"] = user_id
self["device_id"] = device_id
self["time"] = time
Expand Down Expand Up @@ -271,6 +275,7 @@ def __init__(self, user_id: Optional[str] = None,
self["insert_id"] = insert_id
self["plan"] = plan
self["partner_id"] = partner_id
self["version_name"] = version_name
self.event_callback: Optional[Callable[[EventOptions, int, Optional[str]], None]] = callback
self.__retry: int = 0

Expand Down