Skip to content

Commit d87fcf2

Browse files
committed
fix: set both api_key and project_api_key in example.py
The PostHog module-level functions require api_key to be set, while project_api_key is used for local evaluation and other features. Setting both ensures all functionality works correctly.
1 parent 077eb70 commit d87fcf2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

example.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ def load_env_file():
4141

4242
# Load configuration from environment variables with fallbacks
4343
# You can find your project API key on the /setup page in PostHog
44-
posthog.project_api_key = os.getenv("POSTHOG_PROJECT_API_KEY", "phc_gtWmTq3Pgl06u4sZY3TRcoQfp42yfuXHKoe8ZVSR6Kh")
44+
project_key = os.getenv("POSTHOG_PROJECT_API_KEY", "phc_gtWmTq3Pgl06u4sZY3TRcoQfp42yfuXHKoe8ZVSR6Kh")
45+
posthog.api_key = project_key # Required for module-level functions
46+
posthog.project_api_key = project_key # Used for local evaluation and other features
4547
posthog.personal_api_key = os.getenv("POSTHOG_PERSONAL_API_KEY", "phx_fiRCOQkTA3o2ePSdLrFDAILLHjMu2Mv52vUi8MNruIm")
4648

4749
# Where you host PostHog, with no trailing /.

0 commit comments

Comments
 (0)