The official Amplitude Experiment Python SDK for server-side instrumentation.
Project description
Experiment Python SDK
Amplitude Python Server SDK for Experiment.
Installation
pip install amplitude-experiment
Quick Start
from amplitude_experiment import Experiment, Config, Client, User
# (1) Get your deployment's API key
apiKey = 'YOUR-API-KEY'
# (2) Initialize the experiment client
experiment = Experiment.initialize(api_key)
# (3) Fetch variants for a user
user = User(device_id="abcdefg", user_id="user@company.com", user_properties={
'premium': True
})
# (4) Lookup a flag's variant
#
# To fetch synchronous
variants = experiment.fetch(user)
variant = variants['YOUR-FLAG-KEY']
if variant:
if variant.value == 'on':
# Flag is on
else:
# Flag is off
# To fetch asynchronous
experiment.fetch_async(user, fetch_callback)
def fetch_callback(user, variants):
variant = variants['YOUR-FLAG-KEY']
if variant:
if variant.value == 'on':
# Flag is on
else:
# Flag is off
More Information
Please visit our :100:Developer Center for more instructions on using our the SDK.
See our Experiment Python SDK Docs for a list and description of all available SDK methods.
Need Help?
If you have any problems or issues over our SDK, feel free to create a github issue or submit a request on Amplitude Help.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for amplitude-experiment-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb4c0b154e2d43ca4010a026ec56ade6b3c0f2d05e1a8d3e6c0691dc69d745d0 |
|
MD5 | 1bdb7fd90600a4908e3c866b567bb7e0 |
|
BLAKE2b-256 | 4f556463d7214d87f8849dc9826abb28a0881aa1707b397b107a5e15f29b0238 |
Close
Hashes for amplitude_experiment-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7159211343651d32aabb74f429461df519daf6f21f465b71ca8dc694d5a914ce |
|
MD5 | 62221ab29d445e207aaa5b32fd15c801 |
|
BLAKE2b-256 | 703f3ea86ed0bbd874c66e99cf19e2796879e459827f569664f7f795bcc837f0 |