posthoganalytics 6.4.0__tar.gz → 6.5.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {posthoganalytics-6.4.0/posthoganalytics.egg-info → posthoganalytics-6.5.0}/PKG-INFO +1 -1
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/client.py +2 -0
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/request.py +6 -2
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/test/test_client.py +17 -5
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/version.py +1 -1
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0/posthoganalytics.egg-info}/PKG-INFO +1 -1
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/LICENSE +0 -0
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/MANIFEST.in +0 -0
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/README.md +0 -0
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/__init__.py +0 -0
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/ai/__init__.py +0 -0
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/ai/anthropic/__init__.py +0 -0
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/ai/anthropic/anthropic.py +0 -0
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/ai/anthropic/anthropic_async.py +0 -0
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/ai/anthropic/anthropic_providers.py +0 -0
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/ai/gemini/__init__.py +0 -0
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/ai/gemini/gemini.py +0 -0
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/ai/langchain/__init__.py +0 -0
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/ai/langchain/callbacks.py +0 -0
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/ai/openai/__init__.py +0 -0
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/ai/openai/openai.py +0 -0
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/ai/openai/openai_async.py +0 -0
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/ai/openai/openai_providers.py +0 -0
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/ai/utils.py +0 -0
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/args.py +0 -0
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/consumer.py +0 -0
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/contexts.py +0 -0
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/exception_capture.py +0 -0
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/exception_utils.py +0 -0
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/feature_flags.py +0 -0
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/integrations/__init__.py +0 -0
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/integrations/django.py +0 -0
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/poller.py +0 -0
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/py.typed +0 -0
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/test/__init__.py +0 -0
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/test/test_before_send.py +0 -0
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/test/test_consumer.py +0 -0
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/test/test_contexts.py +0 -0
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/test/test_exception_capture.py +0 -0
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/test/test_feature_flag.py +0 -0
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/test/test_feature_flag_result.py +0 -0
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/test/test_feature_flags.py +0 -0
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/test/test_module.py +0 -0
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/test/test_request.py +0 -0
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/test/test_size_limited_dict.py +0 -0
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/test/test_types.py +0 -0
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/test/test_utils.py +0 -0
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/types.py +0 -0
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/utils.py +0 -0
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics.egg-info/SOURCES.txt +0 -0
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics.egg-info/dependency_links.txt +0 -0
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics.egg-info/requires.txt +0 -0
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics.egg-info/top_level.txt +0 -0
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/pyproject.toml +0 -0
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/setup.cfg +0 -0
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/setup.py +0 -0
- {posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/setup_analytics.py +0 -0
|
@@ -87,6 +87,7 @@ def add_context_tags(properties):
|
|
|
87
87
|
current_context = _get_current_context()
|
|
88
88
|
if current_context:
|
|
89
89
|
context_tags = current_context.collect_tags()
|
|
90
|
+
properties["$context_tags"] = set(context_tags.keys())
|
|
90
91
|
# We want explicitly passed properties to override context tags
|
|
91
92
|
context_tags.update(properties)
|
|
92
93
|
properties = context_tags
|
|
@@ -1644,6 +1645,7 @@ class Client(object):
|
|
|
1644
1645
|
try:
|
|
1645
1646
|
return remote_config(
|
|
1646
1647
|
self.personal_api_key,
|
|
1648
|
+
self.api_key,
|
|
1647
1649
|
self.host,
|
|
1648
1650
|
key,
|
|
1649
1651
|
timeout=self.feature_flags_request_timeout_seconds,
|
|
@@ -132,12 +132,16 @@ def flags(
|
|
|
132
132
|
|
|
133
133
|
|
|
134
134
|
def remote_config(
|
|
135
|
-
personal_api_key: str,
|
|
135
|
+
personal_api_key: str,
|
|
136
|
+
project_api_key: str,
|
|
137
|
+
host: Optional[str] = None,
|
|
138
|
+
key: str = "",
|
|
139
|
+
timeout: int = 15,
|
|
136
140
|
) -> Any:
|
|
137
141
|
"""Get remote config flag value from remote_config API endpoint"""
|
|
138
142
|
return get(
|
|
139
143
|
personal_api_key,
|
|
140
|
-
f"/api/projects/@current/feature_flags/{key}/remote_config
|
|
144
|
+
f"/api/projects/@current/feature_flags/{key}/remote_config?token={project_api_key}",
|
|
141
145
|
host,
|
|
142
146
|
timeout,
|
|
143
147
|
)
|
|
@@ -2,17 +2,18 @@ import time
|
|
|
2
2
|
import unittest
|
|
3
3
|
from datetime import datetime
|
|
4
4
|
from uuid import uuid4
|
|
5
|
-
from posthoganalytics.contexts import get_context_session_id, set_context_session, new_context
|
|
6
5
|
|
|
7
6
|
import mock
|
|
8
7
|
import six
|
|
9
8
|
from parameterized import parameterized
|
|
10
9
|
|
|
11
10
|
from posthoganalytics.client import Client
|
|
11
|
+
from posthoganalytics.contexts import get_context_session_id, new_context, set_context_session
|
|
12
12
|
from posthoganalytics.request import APIError
|
|
13
13
|
from posthoganalytics.test.test_utils import FAKE_TEST_API_KEY
|
|
14
14
|
from posthoganalytics.types import FeatureFlag, LegacyFlagMetadata
|
|
15
15
|
from posthoganalytics.version import VERSION
|
|
16
|
+
from posthoganalytics.contexts import tag
|
|
16
17
|
|
|
17
18
|
|
|
18
19
|
class TestClient(unittest.TestCase):
|
|
@@ -2057,7 +2058,7 @@ class TestClient(unittest.TestCase):
|
|
|
2057
2058
|
|
|
2058
2059
|
def test_set_context_session_override_in_capture(self):
|
|
2059
2060
|
"""Test that explicit session ID overrides context session ID in capture"""
|
|
2060
|
-
from posthoganalytics.contexts import
|
|
2061
|
+
from posthoganalytics.contexts import new_context, set_context_session
|
|
2061
2062
|
|
|
2062
2063
|
with mock.patch("posthog.client.batch_post") as mock_post:
|
|
2063
2064
|
client = Client(FAKE_TEST_API_KEY, on_error=self.set_fail, sync_mode=True)
|
|
@@ -2158,6 +2159,7 @@ class TestClient(unittest.TestCase):
|
|
|
2158
2159
|
self.assertEqual(result, {"test": "payload"})
|
|
2159
2160
|
patch_remote_config.assert_called_once_with(
|
|
2160
2161
|
"test-personal-key",
|
|
2162
|
+
FAKE_TEST_API_KEY,
|
|
2161
2163
|
client.host,
|
|
2162
2164
|
"test-flag",
|
|
2163
2165
|
timeout=client.feature_flags_request_timeout_seconds,
|
|
@@ -2282,9 +2284,7 @@ class TestClient(unittest.TestCase):
|
|
|
2282
2284
|
}
|
|
2283
2285
|
]
|
|
2284
2286
|
},
|
|
2285
|
-
"payloads": {
|
|
2286
|
-
"empty-variant": "" # Empty string payload
|
|
2287
|
-
},
|
|
2287
|
+
"payloads": {"empty-variant": ""}, # Empty string payload
|
|
2288
2288
|
},
|
|
2289
2289
|
}
|
|
2290
2290
|
]
|
|
@@ -2355,3 +2355,15 @@ class TestClient(unittest.TestCase):
|
|
|
2355
2355
|
self.assertEqual(
|
|
2356
2356
|
result["featureFlagPayloads"]["normal-payload-flag"], "normal payload"
|
|
2357
2357
|
)
|
|
2358
|
+
|
|
2359
|
+
def test_context_tags_added(self):
|
|
2360
|
+
with mock.patch("posthog.client.batch_post") as mock_post:
|
|
2361
|
+
client = Client(FAKE_TEST_API_KEY, on_error=self.set_fail, sync_mode=True)
|
|
2362
|
+
|
|
2363
|
+
with new_context():
|
|
2364
|
+
tag("random_tag", 12345)
|
|
2365
|
+
client.capture("python test event", distinct_id="distinct_id")
|
|
2366
|
+
|
|
2367
|
+
batch_data = mock_post.call_args[1]["batch"]
|
|
2368
|
+
msg = batch_data[0]
|
|
2369
|
+
self.assertEqual(msg["properties"]["$context_tags"], ["random_tag"])
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/ai/anthropic/anthropic.py
RENAMED
|
File without changes
|
{posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/ai/anthropic/anthropic_async.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/ai/langchain/callbacks.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/ai/openai/openai_async.py
RENAMED
|
File without changes
|
{posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/ai/openai/openai_providers.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/test/test_exception_capture.py
RENAMED
|
File without changes
|
{posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/test/test_feature_flag.py
RENAMED
|
File without changes
|
{posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/test/test_feature_flag_result.py
RENAMED
|
File without changes
|
{posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/test/test_feature_flags.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics/test/test_size_limited_dict.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{posthoganalytics-6.4.0 → posthoganalytics-6.5.0}/posthoganalytics.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|