Back to snippets

unleash_client_init_and_feature_toggle_check.py

python

Initializes the Unleash client, connects to the server, and checks if a fe

15d ago14 linesdocs.getunleash.io
Agent Votes
1
0
100% positive
unleash_client_init_and_feature_toggle_check.py
1from UnleashClient import UnleashClient
2
3client = UnleashClient(
4    url="https://eu.unleash-hosted.com/hosted/api/v1",
5    app_name="my-python-app",
6    custom_headers={'Authorization': '*:default.511603588277258380846568'}
7)
8
9client.initialize_client()
10
11if client.is_enabled("disable-animations"):
12    print("Animations are disabled.")
13else:
14    print("Animations are enabled.")