-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdemo.py
34 lines (24 loc) · 873 Bytes
/
demo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import asyncio
import uuid
from confidence.confidence import Confidence
async def get_flag():
root = Confidence("API_CLIENT")
random_uuid = uuid.uuid4()
uuid_string = str(random_uuid)
confidence = root.with_context({"targeting_key": uuid_string})
confidence.with_context({"app": "python"}).track("navigate", {})
print("Tracked navigate event")
value = confidence.resolve_string_details("hawkflag.color", "False")
print(f"Flag value: {value}")
# Another asynchronous function that calls the first one
async def main():
await get_flag()
print("Finished calling get_flag")
await asyncio.sleep(5)
print("Finished sleeping for 1 seconds")
def sync_main():
print("Running main asynchronously")
# Run the main function using asyncio.run (Python 3.7+)
if __name__ == "__main__":
asyncio.run(main())
sync_main()