Last active
December 2, 2024 17:11
-
-
Save RobSpectre/99fb46ff18955d5a0b3b8e73f7cf4e52 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ldclient | |
from ldclient.config import Config | |
from ldclient import Context | |
ldclient.set_config(Config('sdk-copy-your-sdk-key-here')) | |
client = ldclient.get() | |
if __name__ == "__main__": | |
alice = Context.builder('user-id-123abc1').kind('user').name('Alice').set('email', '[email protected]').build() | |
flag_value = client.variation("my-first-feature-flag", alice, False) | |
print(f"Alice's flag: {flag_value}") | |
bob = Context.builder('user-id-123abc2').kind('user').name('Bob').set('email', '[email protected]').build() | |
flag_value = client.variation("my-first-feature-flag", bob, False) | |
print(f"Bob's flag: {flag_value}") | |
carlos = Context.builder('user-id-123abc3').kind('beta-tester').name('Carlos').set('email', '[email protected]').build() | |
flag_value = client.variation("my-first-feature-flag", carlos, False) | |
print(f"Carlo's flag: {flag_value}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment