diff --git a/posthog/client.py b/posthog/client.py index 2148e9ff..2ddecca2 100644 --- a/posthog/client.py +++ b/posthog/client.py @@ -1819,6 +1819,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, + ) if send_feature_flag_events: warnings.warn( "send_feature_flag_events is deprecated in get_feature_flag_payload() and will be removed " diff --git a/posthog/test/test_client.py b/posthog/test/test_client.py index a866b90b..8db31fe0 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)