Skip to content

Commit 9906284

Browse files
committed
Add example of using remote_config
1 parent 3cb842a commit 9906284

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

remote_config_example.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env python3
2+
"""
3+
Simple test script for PostHog remote config endpoint.
4+
"""
5+
6+
import posthog
7+
8+
# Initialize PostHog client
9+
#posthog.api_key = "phc_ml85lVi483SwbdDrqgb2LJOSXf050rPNpA6rrz7O5VY"
10+
posthog.api_key = "phc_8oSYhZJ7VpjQFNngdkUzEGctbY1u9P3SNJPcAKAhPvE"
11+
posthog.personal_api_key = "phs_QVofStqGt6UUMTlnxKoXb5cHAkQ7JesCZ1PUxfxNRUHKEUx"
12+
# posthog.personal_api_key = "phx_N8hy6HQcO0vplOc16fY2mYRBWVWl8mLDca38LgdmrwT3isA"
13+
posthog.host = "http://localhost:8000"
14+
posthog.debug = True
15+
16+
def test_remote_config():
17+
"""Test remote config payload retrieval."""
18+
print("Testing remote config endpoint...")
19+
20+
# Test feature flag key - replace with an actual flag key from your project
21+
flag_key = "unencrypted-remote-config-setting"
22+
23+
try:
24+
# Get remote config payload
25+
payload = posthog.get_remote_config_payload(flag_key)
26+
print(f"✅ Success! Remote config payload for '{flag_key}': {payload}")
27+
28+
except Exception as e:
29+
print(f"❌ Error getting remote config: {e}")
30+
31+
if __name__ == "__main__":
32+
test_remote_config()

0 commit comments

Comments
 (0)