| 1 | import os |
| 2 | import ldclient |
| 3 | from ldclient import Context |
| 4 | from ldclient.config import Config |
| 5 | |
| 6 | if __name__ == '__main__': |
| 7 | # This is your LaunchDarkly SDK key. |
| 8 | # Never hardcode your SDK key in production. |
| 9 | ldclient.set_config(Config('YOUR_SDK_KEY')) |
| 10 | |
| 11 | if not ldclient.get().is_initialized(): |
| 12 | print('SDK failed to initialize') |
| 13 | exit() |
| 14 | |
| 15 | # For onboarding purposes only we flush events as soon as |
| 16 | # possible so we quickly detect your connection. |
| 17 | # You don't have to do this in practice because events are automatically flushed. |
| 18 | ldclient.get().flush() |
| 19 | print('SDK successfully initialized') |