Skip to content

Commit 29ecfbe

Browse files
committed
Add example of using remote_config
1 parent 71737b7 commit 29ecfbe

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_..."
10+
posthog.personal_api_key = "phs_..." # or "phx_..."
11+
posthog.host = "http://localhost:8000" # or "https://us.posthog.com"
12+
posthog.debug = True
13+
14+
15+
def test_remote_config():
16+
"""Test remote config payload retrieval."""
17+
print("Testing remote config endpoint...")
18+
19+
# Test feature flag key - replace with an actual flag key from your project
20+
flag_key = "unencrypted-remote-config-setting"
21+
22+
try:
23+
# Get remote config payload
24+
payload = posthog.get_remote_config_payload(flag_key)
25+
print(f"✅ Success! Remote config payload for '{flag_key}': {payload}")
26+
27+
except Exception as e:
28+
print(f"❌ Error getting remote config: {e}")
29+
30+
31+
if __name__ == "__main__":
32+
test_remote_config()

0 commit comments

Comments
 (0)