Skip to content

Commit 1e5fa5f

Browse files
author
Dave Johnston
authored
Create simple_example.py
1 parent 4d66098 commit 1e5fa5f

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import time
2+
3+
from featureflags.client import CfClient
4+
from featureflags.config import *
5+
from featureflags.evaluations.auth_target import Target
6+
from featureflags.util import log
7+
8+
9+
def main():
10+
# Create a Feature Flag Client
11+
client = CfClient("c9b3f14f-6336-4d23-83b4-73f29d1ebeeb")
12+
13+
# Create a target (different targets can get different results based on rules that you add in the UI).
14+
target = Target(identifier='mytarget', name="FriendlyName")
15+
16+
# Loop forever reporting the state of the flag. If there is an error the default value will be returned
17+
while True:
18+
result = client.bool_variation('simpleboolflag', target, False)
19+
log.info("Flag variation %s", result)
20+
time.sleep(10)
21+
22+
close()
23+
24+
25+
if __name__ == "__main__":
26+
main()

0 commit comments

Comments
 (0)