From 28a61e3321dca2b3c79f662557b9a22b708b4208 Mon Sep 17 00:00:00 2001 From: sjaanus Date: Thu, 19 Sep 2024 13:25:16 +0300 Subject: [PATCH 1/3] chore: finalize python sdk example --- frontend/src/component/onboarding/sdkSnippets.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/frontend/src/component/onboarding/sdkSnippets.ts b/frontend/src/component/onboarding/sdkSnippets.ts index f573c76a8e38..66b634891f72 100644 --- a/frontend/src/component/onboarding/sdkSnippets.ts +++ b/frontend/src/component/onboarding/sdkSnippets.ts @@ -99,11 +99,13 @@ var settings = new UnleashSettings() Unleash unleash = new DefaultUnleash(config);`, Python: `from UnleashClient import UnleashClient +import time client = UnleashClient( url="", app_name="unleash-onboarding-python", - custom_headers={'Authorization': '"'}) + refresh_interval=5, + custom_headers={'Authorization': ''}) client.initialize_client()`, JavaScript: `import { UnleashClient } from 'unleash-proxy-client'; @@ -217,7 +219,12 @@ export const checkFlagCodeSnippets: Record = { Rust: ``, '.NET': ``, Java: ``, - Python: ``, + Python: `try: + while True: + print(client.is_enabled("dEE")) + time.sleep(1) +except KeyboardInterrupt: + client.destroy()`, JavaScript: ``, React: ``, Vue: ``, From ad1dd17c6607dcd417ae68a06da344ba7f8cbeb8 Mon Sep 17 00:00:00 2001 From: sjaanus Date: Thu, 19 Sep 2024 13:26:11 +0300 Subject: [PATCH 2/3] chore: finalize python sdk example --- frontend/src/component/onboarding/sdkSnippets.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/component/onboarding/sdkSnippets.ts b/frontend/src/component/onboarding/sdkSnippets.ts index 66b634891f72..917d848e0f6b 100644 --- a/frontend/src/component/onboarding/sdkSnippets.ts +++ b/frontend/src/component/onboarding/sdkSnippets.ts @@ -221,7 +221,7 @@ export const checkFlagCodeSnippets: Record = { Java: ``, Python: `try: while True: - print(client.is_enabled("dEE")) + print(client.is_enabled("")) time.sleep(1) except KeyboardInterrupt: client.destroy()`, From 1c877b99fb11e186a5301f0911430a73542adce7 Mon Sep 17 00:00:00 2001 From: sjaanus Date: Thu, 19 Sep 2024 14:52:18 +0300 Subject: [PATCH 3/3] Fi --- frontend/src/component/onboarding/sdkSnippets.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/frontend/src/component/onboarding/sdkSnippets.ts b/frontend/src/component/onboarding/sdkSnippets.ts index 917d848e0f6b..a761bc667a45 100644 --- a/frontend/src/component/onboarding/sdkSnippets.ts +++ b/frontend/src/component/onboarding/sdkSnippets.ts @@ -99,7 +99,7 @@ var settings = new UnleashSettings() Unleash unleash = new DefaultUnleash(config);`, Python: `from UnleashClient import UnleashClient -import time +import asyncio client = UnleashClient( url="", @@ -219,12 +219,9 @@ export const checkFlagCodeSnippets: Record = { Rust: ``, '.NET': ``, Java: ``, - Python: `try: - while True: - print(client.is_enabled("")) - time.sleep(1) -except KeyboardInterrupt: - client.destroy()`, + Python: `while True: + print(client.is_enabled("")) + asyncio.run(asyncio.sleep(1))`, JavaScript: ``, React: ``, Vue: ``,