Skip to content

Conversation

@haacked
Copy link
Collaborator

@haacked haacked commented Jan 7, 2025

This is a little quality of life improvement. When using the example script, it creates an event for the feature flag person-on-events-enabled. This change adds an optional argument that lets you change the feature-flag key for the event like so:

python3 example.py --flag person-on-events-enabled-v1

If the flag is omitted, the script behaves the same as it always did.

@haacked haacked force-pushed the haacked/allow-passing-flag branch from 4835bf0 to 91268d0 Compare January 7, 2025 22:39
@haacked haacked requested a review from dmarticus February 5, 2025 08:32
Copy link
Contributor

@dmarticus dmarticus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't feel strongly either way about this; I typically just go in and configure the example script to do what I want it to, but this seems useful enough.

print(
posthog.feature_enabled(
"person-on-events-enabled",
args.flag, # Use the flag from command line arguments
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fwiw, this only changes the first test flag in this case, the subsequent flags will still use the hard coded values. Seems fine if you're only really using the example script for the first case.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’ll cross those bridges if the need arises. 😂

@haacked haacked merged commit 994003f into master Feb 7, 2025
2 checks passed
@haacked haacked deleted the haacked/allow-passing-flag branch February 7, 2025 00:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants