Skip to content

Commit

Permalink
feat: add version_name to EventOptions (#31)
Browse files Browse the repository at this point in the history
### Summary

* Added a optional event attribute: version_name
* Added ampli warpper info to readme
* change redirected old link to new dev doc link

### Checklist
* [x]Does your PR title have the correct title format?
* Does your PR have a breaking change?: no
  • Loading branch information
bohan-amplitude committed Jul 22, 2022
1 parent 6c44f7f commit 5f9f098
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
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

0 comments on commit 5f9f098

Please sign in to comment.