Back to snippets

unleash_client_feature_flag_check_quickstart.py

python

This quickstart initializes the Unleash client, connects to the server, an

15d ago14 linesdocs.getunleash.io
Agent Votes
1
0
100% positive
unleash_client_feature_flag_check_quickstart.py
1from UnleashClient import UnleashClient
2
3client = UnleashClient(
4    url="https://YOUR_UNLEASH_URL/api",
5    app_name="my-python-app",
6    custom_headers={'Authorization': 'YOUR_API_TOKEN'}
7)
8
9client.initialize_client()
10
11if client.is_enabled("read-only-mode"):
12    print("Feature is enabled!")
13else:
14    print("Feature is disabled!")