wingify-fme-python-sdk 1.70.0__py3-none-any.whl
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.
- tests/data/__init__.py +13 -0
- tests/data/dummy_test_data_reader.py +63 -0
- tests/data/user_storage.py +48 -0
- tests/e2e/__init__.py +13 -0
- tests/e2e/custom_bucketing_test.py +514 -0
- tests/e2e/force_users_test.py +368 -0
- tests/e2e/get_flag_test.py +195 -0
- tests/unit/__init__.py +13 -0
- tests/unit/packages/__init__.py +13 -0
- tests/unit/packages/decision_maker/__init__.py +13 -0
- tests/unit/packages/decision_maker/decision_maker_test.py +83 -0
- tests/unit/packages/segmentation_evaluator/__init__.py +13 -0
- tests/unit/packages/segmentation_evaluator/segmentation_evaluator_test.py +284 -0
- tests/unit/packages/segmentation_evaluator/segmentation_manager_test.py +215 -0
- tests/unit/packages/segmentation_evaluator/web_testing_segment_test.py +216 -0
- tests/unit/services/__init__.py +0 -0
- tests/unit/services/hooks_manager_test.py +80 -0
- tests/unit/services/internal_events_sampling_service_test.py +160 -0
- tests/unit/settings/__init__.py +13 -0
- tests/unit/settings/settings_schema_validation_test.py +67 -0
- tests/unit/utils/__init__.py +0 -0
- tests/unit/utils/campaign_util_test.py +248 -0
- tests/unit/utils/decision_util_force_users_test.py +790 -0
- tests/unit/utils/log_message_test.py +65 -0
- tests/unit/vwo_wingify_test.py +175 -0
- tests/unit/wingify_client_validation_test.py +72 -0
- vwo/__init__.py +35 -0
- vwo/models/__init__.py +13 -0
- vwo/models/batch_event_data.py +19 -0
- vwo/models/user/__init__.py +13 -0
- vwo/models/user/context_vwo_model.py +21 -0
- vwo/models/user/get_flag.py +19 -0
- vwo/models/vwo_options_model.py +21 -0
- vwo/packages/__init__.py +13 -0
- vwo/packages/logger/__init__.py +13 -0
- vwo/packages/logger/enums/__init__.py +13 -0
- vwo/packages/logger/enums/log_level_enum.py +19 -0
- vwo/packages/storage/__init__.py +13 -0
- vwo/packages/storage/connector.py +19 -0
- vwo/vwo.py +58 -0
- vwo/vwo_builder.py +21 -0
- vwo/vwo_client.py +22 -0
- wingify/__init__.py +36 -0
- wingify/api/__init__.py +13 -0
- wingify/api/get_flag_api.py +727 -0
- wingify/api/set_attribute_api.py +60 -0
- wingify/api/track_api.py +99 -0
- wingify/constants/Constants.py +94 -0
- wingify/constants/__init__.py +13 -0
- wingify/constants/sampled_debug_error_template_keys.py +34 -0
- wingify/decorators/__init__.py +13 -0
- wingify/decorators/storage_decorator.py +92 -0
- wingify/enums/__init__.py +13 -0
- wingify/enums/api_enum.py +26 -0
- wingify/enums/campaign_type_enum.py +22 -0
- wingify/enums/debug_category_enum.py +24 -0
- wingify/enums/event_enum.py +26 -0
- wingify/enums/headers_enum.py +21 -0
- wingify/enums/hooks_enum.py +24 -0
- wingify/enums/status_enum.py +21 -0
- wingify/enums/storage_enum.py +25 -0
- wingify/enums/url_enum.py +29 -0
- wingify/models/Alias.py +60 -0
- wingify/models/AliasSetResponse.py +43 -0
- wingify/models/__init__.py +13 -0
- wingify/models/batch_event_data.py +68 -0
- wingify/models/campaign/__init__.py +13 -0
- wingify/models/campaign/campaign_model.py +140 -0
- wingify/models/campaign/feature_model.py +95 -0
- wingify/models/campaign/holdout_model.py +94 -0
- wingify/models/campaign/impact_campaign_model.py +60 -0
- wingify/models/campaign/metric_model.py +42 -0
- wingify/models/campaign/rule_model.py +42 -0
- wingify/models/campaign/variable_model.py +44 -0
- wingify/models/campaign/variation_model.py +109 -0
- wingify/models/gateway_service_model.py +48 -0
- wingify/models/schemas/__init__.py +13 -0
- wingify/models/schemas/campaign_group_schema.py +19 -0
- wingify/models/schemas/campaign_metric_schema.py +26 -0
- wingify/models/schemas/campaign_schema.py +37 -0
- wingify/models/schemas/campaign_variation_schema.py +34 -0
- wingify/models/schemas/empty_object_schema.py +15 -0
- wingify/models/schemas/feature_schema.py +38 -0
- wingify/models/schemas/group_schema.py +37 -0
- wingify/models/schemas/holdout_schema.py +29 -0
- wingify/models/schemas/rule_schema.py +24 -0
- wingify/models/schemas/settings_schema.py +47 -0
- wingify/models/schemas/variable_schema.py +24 -0
- wingify/models/settings/__init__.py +13 -0
- wingify/models/settings/internal_event_sampling_settings_model.py +53 -0
- wingify/models/settings/settings_model.py +127 -0
- wingify/models/storage/__init__.py +13 -0
- wingify/models/storage/storage_model.py +84 -0
- wingify/models/user/__init__.py +13 -0
- wingify/models/user/context_model.py +113 -0
- wingify/models/user/context_vwo_model.py +34 -0
- wingify/models/user/get_flag.py +47 -0
- wingify/models/vwo_options_model.py +21 -0
- wingify/models/wingify_options_model.py +129 -0
- wingify/packages/__init__.py +13 -0
- wingify/packages/decision_maker/__init__.py +13 -0
- wingify/packages/decision_maker/decision_maker.py +89 -0
- wingify/packages/logger/__init__.py +13 -0
- wingify/packages/logger/core/__init__.py +13 -0
- wingify/packages/logger/core/log_manager.py +123 -0
- wingify/packages/logger/core/log_transport_manager.py +57 -0
- wingify/packages/logger/enums/__init__.py +13 -0
- wingify/packages/logger/enums/log_level_enum.py +24 -0
- wingify/packages/logger/enums/log_level_number_enum.py +21 -0
- wingify/packages/logger/log_message_builder.py +70 -0
- wingify/packages/logger/logger.py +38 -0
- wingify/packages/logger/transports/__init__.py +13 -0
- wingify/packages/logger/transports/console_transport.py +43 -0
- wingify/packages/network_layer/__init__.py +13 -0
- wingify/packages/network_layer/client/__init__.py +13 -0
- wingify/packages/network_layer/client/network_client.py +167 -0
- wingify/packages/network_layer/handlers/__init__.py +13 -0
- wingify/packages/network_layer/handlers/request_handler.py +40 -0
- wingify/packages/network_layer/manager/__init__.py +13 -0
- wingify/packages/network_layer/manager/network_manager.py +79 -0
- wingify/packages/network_layer/models/__init__.py +13 -0
- wingify/packages/network_layer/models/global_request_model.py +70 -0
- wingify/packages/network_layer/models/request_model.py +133 -0
- wingify/packages/network_layer/models/response_model.py +55 -0
- wingify/packages/segmentation_evaluator/__init__.py +13 -0
- wingify/packages/segmentation_evaluator/core/__init__.py +13 -0
- wingify/packages/segmentation_evaluator/core/segmentation_manager.py +140 -0
- wingify/packages/segmentation_evaluator/enums/__init__.py +13 -0
- wingify/packages/segmentation_evaluator/enums/segment_operand_regex_enum.py +31 -0
- wingify/packages/segmentation_evaluator/enums/segment_operand_value_enum.py +29 -0
- wingify/packages/segmentation_evaluator/enums/segment_operator_value_enum.py +37 -0
- wingify/packages/segmentation_evaluator/evaluators/__init__.py +13 -0
- wingify/packages/segmentation_evaluator/evaluators/segment_evaluator.py +237 -0
- wingify/packages/segmentation_evaluator/evaluators/segment_operand_evaluator.py +518 -0
- wingify/packages/segmentation_evaluator/utils/__init__.py +13 -0
- wingify/packages/segmentation_evaluator/utils/segment_util.py +33 -0
- wingify/packages/segmentation_evaluator/utils/web_testing_segment_util.py +295 -0
- wingify/packages/storage/__init__.py +13 -0
- wingify/packages/storage/connector.py +25 -0
- wingify/packages/storage/storage.py +39 -0
- wingify/resources/__init__.py +13 -0
- wingify/resources/debug-messages.json +21 -0
- wingify/resources/error-messages.json +62 -0
- wingify/resources/info-message.json +47 -0
- wingify/resources/trace-messages.json +1 -0
- wingify/resources/warn-messages.json +1 -0
- wingify/services/__init__.py +13 -0
- wingify/services/batch_event_queue.py +140 -0
- wingify/services/campaign_decision_service.py +268 -0
- wingify/services/hooks_manager.py +65 -0
- wingify/services/internal_events_sampling_service.py +62 -0
- wingify/services/settings_manager.py +293 -0
- wingify/services/storage_service.py +58 -0
- wingify/services/url_service.py +51 -0
- wingify/utils/__init__.py +13 -0
- wingify/utils/aliasing_util.py +108 -0
- wingify/utils/brand_context.py +26 -0
- wingify/utils/brand_util.py +37 -0
- wingify/utils/campaign_util.py +592 -0
- wingify/utils/data_type_util.py +125 -0
- wingify/utils/debugger_service_util.py +58 -0
- wingify/utils/decision_util.py +589 -0
- wingify/utils/event_util.py +85 -0
- wingify/utils/function_util.py +188 -0
- wingify/utils/gateway_service_util.py +179 -0
- wingify/utils/holdout_util.py +264 -0
- wingify/utils/impression_util.py +151 -0
- wingify/utils/internal_events_sampling_util.py +106 -0
- wingify/utils/log_message_util.py +95 -0
- wingify/utils/meg_util.py +561 -0
- wingify/utils/model_utils.py +136 -0
- wingify/utils/network_util.py +706 -0
- wingify/utils/rule_evaluation_util.py +102 -0
- wingify/utils/settings_util.py +39 -0
- wingify/utils/usage_stats_util.py +116 -0
- wingify/utils/uuid_util.py +81 -0
- wingify/vwo_client.py +21 -0
- wingify/wingify.py +159 -0
- wingify/wingify_builder.py +282 -0
- wingify/wingify_client.py +520 -0
- wingify_fme_python_sdk-1.70.0.dist-info/METADATA +1415 -0
- wingify_fme_python_sdk-1.70.0.dist-info/RECORD +186 -0
- wingify_fme_python_sdk-1.70.0.dist-info/WHEEL +5 -0
- wingify_fme_python_sdk-1.70.0.dist-info/licenses/LICENSE +202 -0
- wingify_fme_python_sdk-1.70.0.dist-info/licenses/NOTICE +18 -0
- wingify_fme_python_sdk-1.70.0.dist-info/top_level.txt +3 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# Copyright 2024-2026 Wingify Software Pvt. Ltd.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
from typing import Any, Dict, Callable, List
|
|
17
|
+
import re
|
|
18
|
+
from datetime import datetime
|
|
19
|
+
|
|
20
|
+
# Define a generic dynamic type
|
|
21
|
+
dynamic = Any
|
|
22
|
+
|
|
23
|
+
# Define a function type for comparison
|
|
24
|
+
FunctionType = Callable[[dynamic], None]
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def is_object(val: dynamic) -> bool:
|
|
28
|
+
"""Checks if a value is an object excluding arrays, functions, regexes, promises, and dates."""
|
|
29
|
+
return isinstance(val, Dict)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def is_array(val: dynamic) -> bool:
|
|
33
|
+
"""Checks if a value is an array (List in Python)."""
|
|
34
|
+
return isinstance(val, List)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def is_null(val: dynamic) -> bool:
|
|
38
|
+
"""Checks if a value is None (null in Python)."""
|
|
39
|
+
return val is None
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def is_undefined(val: dynamic) -> bool:
|
|
43
|
+
"""Checks if a value is None (undefined in Python)."""
|
|
44
|
+
# In Python, 'undefined' is typically treated as None
|
|
45
|
+
return val is None
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def is_defined(val: dynamic) -> bool:
|
|
49
|
+
"""Checks if a value is defined, i.e., not None."""
|
|
50
|
+
return val is not None
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def is_number(val: dynamic) -> bool:
|
|
54
|
+
"""Checks if a value is a number, including NaN."""
|
|
55
|
+
return isinstance(val, (int, float))
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def is_string(val: dynamic) -> bool:
|
|
59
|
+
"""Checks if a value is a string."""
|
|
60
|
+
return isinstance(val, str)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def is_boolean(val: dynamic) -> bool:
|
|
64
|
+
"""Checks if a value is a boolean."""
|
|
65
|
+
return isinstance(val, bool)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def is_nan(val: dynamic) -> bool:
|
|
69
|
+
"""Checks if a value is NaN."""
|
|
70
|
+
try:
|
|
71
|
+
return isinstance(val, float) and val != val
|
|
72
|
+
except TypeError:
|
|
73
|
+
return False
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def is_date(val: dynamic) -> bool:
|
|
77
|
+
"""Checks if a value is a Date object."""
|
|
78
|
+
return isinstance(val, datetime)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def is_function(val: dynamic) -> bool:
|
|
82
|
+
"""Checks if a value is a function."""
|
|
83
|
+
return callable(val)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def is_regex(val: dynamic) -> bool:
|
|
87
|
+
"""Checks if a value is a regular expression."""
|
|
88
|
+
return isinstance(val, re.Pattern)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def is_promise(val: dynamic) -> bool:
|
|
92
|
+
"""Checks if a value is a Future object (closest to a Promise in Python)."""
|
|
93
|
+
from concurrent.futures import Future
|
|
94
|
+
|
|
95
|
+
return isinstance(val, Future)
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def get_type(val: dynamic) -> str:
|
|
99
|
+
"""Determines the type of the given value using various type-checking utility functions."""
|
|
100
|
+
if is_object(val):
|
|
101
|
+
return "Object"
|
|
102
|
+
elif is_array(val):
|
|
103
|
+
return "Array"
|
|
104
|
+
elif is_null(val):
|
|
105
|
+
return "Null"
|
|
106
|
+
elif is_undefined(val):
|
|
107
|
+
return "Undefined"
|
|
108
|
+
elif is_nan(val):
|
|
109
|
+
return "NaN"
|
|
110
|
+
elif is_number(val):
|
|
111
|
+
return "Number"
|
|
112
|
+
elif is_string(val):
|
|
113
|
+
return "String"
|
|
114
|
+
elif is_boolean(val):
|
|
115
|
+
return "Boolean"
|
|
116
|
+
elif is_date(val):
|
|
117
|
+
return "Date"
|
|
118
|
+
elif is_regex(val):
|
|
119
|
+
return "Regex"
|
|
120
|
+
elif is_function(val):
|
|
121
|
+
return "Function"
|
|
122
|
+
elif is_promise(val):
|
|
123
|
+
return "Promise"
|
|
124
|
+
else:
|
|
125
|
+
return "Unknown Type"
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Copyright 2024-2026 Wingify Software Pvt. Ltd.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
from typing import Any, Dict
|
|
17
|
+
from ..enums.event_enum import EventEnum
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def send_debug_event_to_vwo(debug_event_props: Dict[str, Any]):
|
|
21
|
+
"""
|
|
22
|
+
Sends a debug event to VWO.
|
|
23
|
+
|
|
24
|
+
:param debug_event_props: The properties of the debug event.
|
|
25
|
+
"""
|
|
26
|
+
try:
|
|
27
|
+
# Lazy import to avoid circular dependency with LogManager
|
|
28
|
+
from ..utils.network_util import (
|
|
29
|
+
get_events_base_properties,
|
|
30
|
+
get_debugger_event_payload,
|
|
31
|
+
send_event,
|
|
32
|
+
)
|
|
33
|
+
from ..utils.internal_events_sampling_util import is_sampled_debug_error_template_key
|
|
34
|
+
from ..services.internal_events_sampling_service import InternalEventsSamplingService
|
|
35
|
+
from ..wingify import Wingify
|
|
36
|
+
|
|
37
|
+
# Sampled keys: apply sampling only when alwaysApplySampling.server is true; others are ALWAYS_SEND
|
|
38
|
+
msg_t = debug_event_props.get("msg_t")
|
|
39
|
+
is_sampled_debug_event = isinstance(msg_t, str) and is_sampled_debug_error_template_key(msg_t)
|
|
40
|
+
|
|
41
|
+
instance = Wingify.getInstance()
|
|
42
|
+
settings = getattr(instance, '_settings', None) if instance else None
|
|
43
|
+
# if the event is present in the sampled debug events keys list, then apply sampling
|
|
44
|
+
if is_sampled_debug_event:
|
|
45
|
+
sampling_service = InternalEventsSamplingService()
|
|
46
|
+
if not sampling_service.should_send_sampled_debug_event(settings):
|
|
47
|
+
return
|
|
48
|
+
|
|
49
|
+
# Create the query parameters
|
|
50
|
+
properties = get_events_base_properties(EventEnum.DEBUGGER_EVENT.value)
|
|
51
|
+
# Create the payload with required fields
|
|
52
|
+
payload = get_debugger_event_payload(debug_event_props)
|
|
53
|
+
|
|
54
|
+
# Send the constructed payload via POST request
|
|
55
|
+
send_event(properties, payload, EventEnum.DEBUGGER_EVENT.value)
|
|
56
|
+
except Exception as e:
|
|
57
|
+
from ..packages.logger.core.log_manager import LogManager
|
|
58
|
+
LogManager.get_instance().error_log("ERROR_SENDING_DEBUG_EVENT", data={"err": str(e)}, debug_data=debug_event_props)
|