Skip to content

Commit 994003f

Browse files
authored
Allow specifying the flag in the example script (#157)
* Allow specifying the flag in the example script * Reformat * Run isort
1 parent 319b380 commit 994003f

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

example.py

+9-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
# PostHog Python library example
2-
3-
# Import the library
4-
# import time
2+
import argparse
53

64
import posthog
75

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

1015
# You can find this key on the /setup page in PostHog
@@ -18,7 +23,7 @@
1823

1924
print(
2025
posthog.feature_enabled(
21-
"person-on-events-enabled",
26+
args.flag, # Use the flag from command line arguments
2227
"12345",
2328
groups={"organization": str("0182ee91-8ef7-0000-4cb9-fedc5f00926a")},
2429
group_properties={

0 commit comments

Comments
 (0)