Created
December 2, 2024 16:46
-
-
Save RobSpectre/592e933bbc35ea445b752cd3deef794d to your computer and use it in GitHub Desktop.
quickstart.py
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-key-here')) | |
client = ldclient.get() | |
if __name__ == "__main__": | |
if client.is_initialized(): | |
print("LaunchDarkly is successfully authenticated to your account.") | |
else: | |
print("There was an issue authenticating - is the SDK key correct?") | |
context = Context.builder('user-id-123abc').kind('user').name('Sandy').set('email', '[email protected]').build() | |
flag_value = client.variation("my-first-feature-flag", context, False) | |
print(f"Our first feature flag is: {flag_value}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment