Experiment Python SDK
Amplitude Python Server SDK for Experiment.
Installation
pip install amplitude-experiment
Remote Evaluation Quick Start
from amplitude_experiment import Experiment, RemoteEvaluationConfig, RemoteEvaluationClient, User
apiKey = 'YOUR-API-KEY'
experiment = Experiment.initialize_remote(api_key)
user = User(
device_id="abcdefg",
user_id="user@company.com",
user_properties={
'premium': True
}
)
variants = experiment.fetch(user)
variant = variants['YOUR-FLAG-KEY']
if variant:
if variant.value == 'on':
else:
experiment.fetch_async(user, fetch_callback)
def fetch_callback(user, variants):
variant = variants['YOUR-FLAG-KEY']
if variant:
if variant.value == 'on':
else:
Local Evaluation Quick Start
experiment = Experiment.initialize_local(api_key)
experiment.start()
user = User(
device_id="abcdefg",
user_id="user@company.com",
user_properties={
'premium': True
}
)
variants = experiment.evaluate(user)
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.