gofeatureflag-python-provider 0.4.2__tar.gz → 0.4.4__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.
- {gofeatureflag_python_provider-0.4.2 → gofeatureflag_python_provider-0.4.4}/PKG-INFO +1 -2
- {gofeatureflag_python_provider-0.4.2 → gofeatureflag_python_provider-0.4.4}/gofeatureflag_python_provider/data_collector_hook.py +2 -2
- {gofeatureflag_python_provider-0.4.2 → gofeatureflag_python_provider-0.4.4}/gofeatureflag_python_provider/provider.py +9 -4
- {gofeatureflag_python_provider-0.4.2 → gofeatureflag_python_provider-0.4.4}/pyproject.toml +1 -2
- {gofeatureflag_python_provider-0.4.2 → gofeatureflag_python_provider-0.4.4}/README.md +0 -0
- {gofeatureflag_python_provider-0.4.2 → gofeatureflag_python_provider-0.4.4}/gofeatureflag_python_provider/__init__.py +0 -0
- {gofeatureflag_python_provider-0.4.2 → gofeatureflag_python_provider-0.4.4}/gofeatureflag_python_provider/metadata.py +0 -0
- {gofeatureflag_python_provider-0.4.2 → gofeatureflag_python_provider-0.4.4}/gofeatureflag_python_provider/options.py +0 -0
- {gofeatureflag_python_provider-0.4.2 → gofeatureflag_python_provider-0.4.4}/gofeatureflag_python_provider/request_data_collector.py +0 -0
- {gofeatureflag_python_provider-0.4.2 → gofeatureflag_python_provider-0.4.4}/gofeatureflag_python_provider/request_flag_evaluation.py +0 -0
- {gofeatureflag_python_provider-0.4.2 → gofeatureflag_python_provider-0.4.4}/gofeatureflag_python_provider/response_flag_evaluation.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: gofeatureflag-python-provider
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.4
|
|
4
4
|
Summary: GO Feature Flag provider for OpenFeature
|
|
5
5
|
License: Apache-2.0
|
|
6
6
|
Keywords: feature flags,feature toggles,go-feature-flag,gofeatureflag,openfeature,open-feature
|
|
@@ -15,7 +15,6 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.13
|
|
16
16
|
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
17
17
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
18
|
-
Requires-Dist: asyncio (>=3.4.3,<4.0.0)
|
|
19
18
|
Requires-Dist: openfeature-sdk (>=0.5.0,<0.9.0)
|
|
20
19
|
Requires-Dist: pydantic (>=2.5.2,<3.0.0)
|
|
21
20
|
Requires-Dist: pylru (>=1.2.1,<2.0.0)
|
|
@@ -52,7 +52,7 @@ class DataCollectorHook(Hook):
|
|
|
52
52
|
feature_event = FeatureEvent(
|
|
53
53
|
contextKind=(
|
|
54
54
|
"anonymousUser"
|
|
55
|
-
if hook_context.evaluation_context.attributes
|
|
55
|
+
if hook_context.evaluation_context.attributes.get("anonymous", False)
|
|
56
56
|
else "user"
|
|
57
57
|
),
|
|
58
58
|
creationDate=int(datetime.datetime.now().timestamp()),
|
|
@@ -73,7 +73,7 @@ class DataCollectorHook(Hook):
|
|
|
73
73
|
feature_event = FeatureEvent(
|
|
74
74
|
contextKind=(
|
|
75
75
|
"anonymousUser"
|
|
76
|
-
if hook_context.evaluation_context.attributes
|
|
76
|
+
if hook_context.evaluation_context.attributes.get("anonymous", False)
|
|
77
77
|
else "user"
|
|
78
78
|
),
|
|
79
79
|
creationDate=int(datetime.datetime.now().timestamp()),
|
|
@@ -70,9 +70,14 @@ class GoFeatureFlagProvider(BaseModel, AbstractProvider, metaclass=CombinedMetac
|
|
|
70
70
|
websocket.enableTrace(self.options.debug)
|
|
71
71
|
self._ws = websocket.WebSocketApp(
|
|
72
72
|
self._build_websocket_uri(),
|
|
73
|
+
on_open=self.on_open,
|
|
73
74
|
on_message=self._websocket_message_handler,
|
|
74
75
|
)
|
|
75
76
|
|
|
77
|
+
def on_open(self, ws):
|
|
78
|
+
if self._cache is not None:
|
|
79
|
+
self._cache.clear()
|
|
80
|
+
|
|
76
81
|
def initialize(self, evaluation_context: EvaluationContext) -> None:
|
|
77
82
|
"""
|
|
78
83
|
initialize is called when the provider is initialized.
|
|
@@ -179,11 +184,11 @@ class GoFeatureFlagProvider(BaseModel, AbstractProvider, metaclass=CombinedMetac
|
|
|
179
184
|
user=goff_evaluation_context,
|
|
180
185
|
defaultValue=default_value,
|
|
181
186
|
)
|
|
182
|
-
|
|
187
|
+
cache_key = f"{flag_key}:{goff_evaluation_context.hash()}"
|
|
183
188
|
is_from_cache = False
|
|
184
189
|
|
|
185
|
-
if
|
|
186
|
-
response_body = self._cache[
|
|
190
|
+
if cache_key in self._cache:
|
|
191
|
+
response_body = self._cache[cache_key]
|
|
187
192
|
is_from_cache = True
|
|
188
193
|
else:
|
|
189
194
|
headers = {"Content-Type": "application/json"}
|
|
@@ -240,7 +245,7 @@ class GoFeatureFlagProvider(BaseModel, AbstractProvider, metaclass=CombinedMetac
|
|
|
240
245
|
)
|
|
241
246
|
|
|
242
247
|
if response_flag_evaluation.cacheable:
|
|
243
|
-
self._cache[
|
|
248
|
+
self._cache[cache_key] = response_body
|
|
244
249
|
|
|
245
250
|
if original_type == int:
|
|
246
251
|
response_json = json.loads(response_body)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "gofeatureflag-python-provider"
|
|
3
|
-
version = "0.4.
|
|
3
|
+
version = "0.4.4"
|
|
4
4
|
description = "GO Feature Flag provider for OpenFeature"
|
|
5
5
|
license = "Apache-2.0"
|
|
6
6
|
authors = [ "Thomas Poignant" ]
|
|
@@ -34,7 +34,6 @@ classifiers = [
|
|
|
34
34
|
pylru = "^1.2.1"
|
|
35
35
|
websocket-client = "^1.6.4"
|
|
36
36
|
rel = "^0.4.9"
|
|
37
|
-
asyncio = "^3.4.3"
|
|
38
37
|
|
|
39
38
|
[tool.poetry.group.dev.dependencies]
|
|
40
39
|
pytest = ">=7.4,<9.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|