From 71489a65e1b879b1cba807b025c6ca84c8830776 Mon Sep 17 00:00:00 2001 From: mohamed zair Date: Wed, 17 Dec 2025 17:59:42 +0100 Subject: [PATCH 1/2] feat: Deprecate get_feature_flag_payload in favor of get_feature_flag_result --- posthog/client.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/posthog/client.py b/posthog/client.py index ce503822..415d0397 100644 --- a/posthog/client.py +++ b/posthog/client.py @@ -2,6 +2,7 @@ import logging import os import sys +import warnings from datetime import datetime, timedelta from typing import Any, Dict, Optional, Union from typing_extensions import Unpack @@ -1827,6 +1828,12 @@ def get_feature_flag_payload( Category: Feature flags """ + warnings.warn( + "get_feature_flag_payload is deprecated and will be removed in a future version. " + "Please use get_feature_flag_result instead.", + DeprecationWarning, + stacklevel=2, + ) feature_flag_result = self._get_feature_flag_result( key, distinct_id, From 08c3f3b774cb8e796ee44312b57059dd4678ec40 Mon Sep 17 00:00:00 2001 From: mohamed zair Date: Wed, 17 Dec 2025 18:20:53 +0100 Subject: [PATCH 2/2] test: Add coverage for deprecation warning --- posthog/test/test_client.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/posthog/test/test_client.py b/posthog/test/test_client.py index a2932946..8417c930 100644 --- a/posthog/test/test_client.py +++ b/posthog/test/test_client.py @@ -44,7 +44,11 @@ def test_requires_api_key(self): def test_empty_flush(self): self.client.flush() - + def test_get_feature_flag_payload_deprecation_warning(self): + # This tells Python: "Expect a DeprecationWarning in the next line" + with self.assertWarns(DeprecationWarning): + self.client.get_feature_flag_payload("key", "distinct_id") + def test_basic_capture(self): with mock.patch("posthog.client.batch_post") as mock_post: client = Client(FAKE_TEST_API_KEY, on_error=self.set_fail, sync_mode=True)