Skip to content

Commit 68e6cef

Browse files
committed
Allow specifying the flag in the example script
1 parent 05932b3 commit 68e6cef

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

example.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
# PostHog Python library example
2-
3-
# Import the library
4-
# import time
5-
2+
import argparse
63
import posthog
74

5+
# Add argument parsing
6+
parser = argparse.ArgumentParser(description='PostHog Python library example')
7+
parser.add_argument('--flag',
8+
default='person-on-events-enabled',
9+
help='Feature flag key to check (default: person-on-events-enabled)')
10+
args = parser.parse_args()
11+
812
posthog.debug = True
913

1014
# You can find this key on the /setup page in PostHog
@@ -18,7 +22,7 @@
1822

1923
print(
2024
posthog.feature_enabled(
21-
"person-on-events-enabled",
25+
args.flag, # Use the flag from command line arguments
2226
"12345",
2327
groups={"organization": str("0182ee91-8ef7-0000-4cb9-fedc5f00926a")},
2428
group_properties={

0 commit comments

Comments
 (0)