From 86faab680b93e6eebc4319b3060d01f0ce7e5116 Mon Sep 17 00:00:00 2001 From: Peter Loomis Date: Fri, 6 May 2022 08:26:06 -0700 Subject: [PATCH] Update README.md --- README.md | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f82c56c..d160d46 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,38 @@ # Eppo SDK for Python +## Getting Started + +### Install and initialize the SDK client +Install the package: +``` +python3 -m pip install --upgrade eppo-server-sdk +``` + +Initialize the SDK with your Eppo API key: +``` +import eppo_client +from eppo_client import Config + +eppo_client.init(Config(api_key="")) +``` +**The `init` method should be called once on applications startup**. The initialization method kicks off a polling process to retrieve experiment configurations from Eppo at regular intervals. + +### Use the client to assign variations +Prerequisite: you must have configured an experiment in Eppo. To assign variations, your experiment should have a `RUNNING` status and a non-zero traffic allocation. + +Use the assignment API in any part of your code that needs to assign subjects to experiment variations: +``` +import eppo_client + +client = eppo_client.get_instance() +assigned_variation = client.assign("", "") +``` + +The `subject` argument can be any entity identifier (e.g. a user ID). The experimentKey argument is the identifier of your Eppo experiment. + +The `assign` function will return null if the experiment is not running or if the subject is not part of the experiment traffic allocation. + +The `eppo_client.get_instance()` method returns a singleton client instance that is intended to be reused for the lifetime of your application. + ## Supported Python Versions -This version of the SDK is compatible with Python 3.6 and above. \ No newline at end of file +This version of the SDK is compatible with Python 3.6 and above.