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.
Files changed (186) hide show
  1. tests/data/__init__.py +13 -0
  2. tests/data/dummy_test_data_reader.py +63 -0
  3. tests/data/user_storage.py +48 -0
  4. tests/e2e/__init__.py +13 -0
  5. tests/e2e/custom_bucketing_test.py +514 -0
  6. tests/e2e/force_users_test.py +368 -0
  7. tests/e2e/get_flag_test.py +195 -0
  8. tests/unit/__init__.py +13 -0
  9. tests/unit/packages/__init__.py +13 -0
  10. tests/unit/packages/decision_maker/__init__.py +13 -0
  11. tests/unit/packages/decision_maker/decision_maker_test.py +83 -0
  12. tests/unit/packages/segmentation_evaluator/__init__.py +13 -0
  13. tests/unit/packages/segmentation_evaluator/segmentation_evaluator_test.py +284 -0
  14. tests/unit/packages/segmentation_evaluator/segmentation_manager_test.py +215 -0
  15. tests/unit/packages/segmentation_evaluator/web_testing_segment_test.py +216 -0
  16. tests/unit/services/__init__.py +0 -0
  17. tests/unit/services/hooks_manager_test.py +80 -0
  18. tests/unit/services/internal_events_sampling_service_test.py +160 -0
  19. tests/unit/settings/__init__.py +13 -0
  20. tests/unit/settings/settings_schema_validation_test.py +67 -0
  21. tests/unit/utils/__init__.py +0 -0
  22. tests/unit/utils/campaign_util_test.py +248 -0
  23. tests/unit/utils/decision_util_force_users_test.py +790 -0
  24. tests/unit/utils/log_message_test.py +65 -0
  25. tests/unit/vwo_wingify_test.py +175 -0
  26. tests/unit/wingify_client_validation_test.py +72 -0
  27. vwo/__init__.py +35 -0
  28. vwo/models/__init__.py +13 -0
  29. vwo/models/batch_event_data.py +19 -0
  30. vwo/models/user/__init__.py +13 -0
  31. vwo/models/user/context_vwo_model.py +21 -0
  32. vwo/models/user/get_flag.py +19 -0
  33. vwo/models/vwo_options_model.py +21 -0
  34. vwo/packages/__init__.py +13 -0
  35. vwo/packages/logger/__init__.py +13 -0
  36. vwo/packages/logger/enums/__init__.py +13 -0
  37. vwo/packages/logger/enums/log_level_enum.py +19 -0
  38. vwo/packages/storage/__init__.py +13 -0
  39. vwo/packages/storage/connector.py +19 -0
  40. vwo/vwo.py +58 -0
  41. vwo/vwo_builder.py +21 -0
  42. vwo/vwo_client.py +22 -0
  43. wingify/__init__.py +36 -0
  44. wingify/api/__init__.py +13 -0
  45. wingify/api/get_flag_api.py +727 -0
  46. wingify/api/set_attribute_api.py +60 -0
  47. wingify/api/track_api.py +99 -0
  48. wingify/constants/Constants.py +94 -0
  49. wingify/constants/__init__.py +13 -0
  50. wingify/constants/sampled_debug_error_template_keys.py +34 -0
  51. wingify/decorators/__init__.py +13 -0
  52. wingify/decorators/storage_decorator.py +92 -0
  53. wingify/enums/__init__.py +13 -0
  54. wingify/enums/api_enum.py +26 -0
  55. wingify/enums/campaign_type_enum.py +22 -0
  56. wingify/enums/debug_category_enum.py +24 -0
  57. wingify/enums/event_enum.py +26 -0
  58. wingify/enums/headers_enum.py +21 -0
  59. wingify/enums/hooks_enum.py +24 -0
  60. wingify/enums/status_enum.py +21 -0
  61. wingify/enums/storage_enum.py +25 -0
  62. wingify/enums/url_enum.py +29 -0
  63. wingify/models/Alias.py +60 -0
  64. wingify/models/AliasSetResponse.py +43 -0
  65. wingify/models/__init__.py +13 -0
  66. wingify/models/batch_event_data.py +68 -0
  67. wingify/models/campaign/__init__.py +13 -0
  68. wingify/models/campaign/campaign_model.py +140 -0
  69. wingify/models/campaign/feature_model.py +95 -0
  70. wingify/models/campaign/holdout_model.py +94 -0
  71. wingify/models/campaign/impact_campaign_model.py +60 -0
  72. wingify/models/campaign/metric_model.py +42 -0
  73. wingify/models/campaign/rule_model.py +42 -0
  74. wingify/models/campaign/variable_model.py +44 -0
  75. wingify/models/campaign/variation_model.py +109 -0
  76. wingify/models/gateway_service_model.py +48 -0
  77. wingify/models/schemas/__init__.py +13 -0
  78. wingify/models/schemas/campaign_group_schema.py +19 -0
  79. wingify/models/schemas/campaign_metric_schema.py +26 -0
  80. wingify/models/schemas/campaign_schema.py +37 -0
  81. wingify/models/schemas/campaign_variation_schema.py +34 -0
  82. wingify/models/schemas/empty_object_schema.py +15 -0
  83. wingify/models/schemas/feature_schema.py +38 -0
  84. wingify/models/schemas/group_schema.py +37 -0
  85. wingify/models/schemas/holdout_schema.py +29 -0
  86. wingify/models/schemas/rule_schema.py +24 -0
  87. wingify/models/schemas/settings_schema.py +47 -0
  88. wingify/models/schemas/variable_schema.py +24 -0
  89. wingify/models/settings/__init__.py +13 -0
  90. wingify/models/settings/internal_event_sampling_settings_model.py +53 -0
  91. wingify/models/settings/settings_model.py +127 -0
  92. wingify/models/storage/__init__.py +13 -0
  93. wingify/models/storage/storage_model.py +84 -0
  94. wingify/models/user/__init__.py +13 -0
  95. wingify/models/user/context_model.py +113 -0
  96. wingify/models/user/context_vwo_model.py +34 -0
  97. wingify/models/user/get_flag.py +47 -0
  98. wingify/models/vwo_options_model.py +21 -0
  99. wingify/models/wingify_options_model.py +129 -0
  100. wingify/packages/__init__.py +13 -0
  101. wingify/packages/decision_maker/__init__.py +13 -0
  102. wingify/packages/decision_maker/decision_maker.py +89 -0
  103. wingify/packages/logger/__init__.py +13 -0
  104. wingify/packages/logger/core/__init__.py +13 -0
  105. wingify/packages/logger/core/log_manager.py +123 -0
  106. wingify/packages/logger/core/log_transport_manager.py +57 -0
  107. wingify/packages/logger/enums/__init__.py +13 -0
  108. wingify/packages/logger/enums/log_level_enum.py +24 -0
  109. wingify/packages/logger/enums/log_level_number_enum.py +21 -0
  110. wingify/packages/logger/log_message_builder.py +70 -0
  111. wingify/packages/logger/logger.py +38 -0
  112. wingify/packages/logger/transports/__init__.py +13 -0
  113. wingify/packages/logger/transports/console_transport.py +43 -0
  114. wingify/packages/network_layer/__init__.py +13 -0
  115. wingify/packages/network_layer/client/__init__.py +13 -0
  116. wingify/packages/network_layer/client/network_client.py +167 -0
  117. wingify/packages/network_layer/handlers/__init__.py +13 -0
  118. wingify/packages/network_layer/handlers/request_handler.py +40 -0
  119. wingify/packages/network_layer/manager/__init__.py +13 -0
  120. wingify/packages/network_layer/manager/network_manager.py +79 -0
  121. wingify/packages/network_layer/models/__init__.py +13 -0
  122. wingify/packages/network_layer/models/global_request_model.py +70 -0
  123. wingify/packages/network_layer/models/request_model.py +133 -0
  124. wingify/packages/network_layer/models/response_model.py +55 -0
  125. wingify/packages/segmentation_evaluator/__init__.py +13 -0
  126. wingify/packages/segmentation_evaluator/core/__init__.py +13 -0
  127. wingify/packages/segmentation_evaluator/core/segmentation_manager.py +140 -0
  128. wingify/packages/segmentation_evaluator/enums/__init__.py +13 -0
  129. wingify/packages/segmentation_evaluator/enums/segment_operand_regex_enum.py +31 -0
  130. wingify/packages/segmentation_evaluator/enums/segment_operand_value_enum.py +29 -0
  131. wingify/packages/segmentation_evaluator/enums/segment_operator_value_enum.py +37 -0
  132. wingify/packages/segmentation_evaluator/evaluators/__init__.py +13 -0
  133. wingify/packages/segmentation_evaluator/evaluators/segment_evaluator.py +237 -0
  134. wingify/packages/segmentation_evaluator/evaluators/segment_operand_evaluator.py +518 -0
  135. wingify/packages/segmentation_evaluator/utils/__init__.py +13 -0
  136. wingify/packages/segmentation_evaluator/utils/segment_util.py +33 -0
  137. wingify/packages/segmentation_evaluator/utils/web_testing_segment_util.py +295 -0
  138. wingify/packages/storage/__init__.py +13 -0
  139. wingify/packages/storage/connector.py +25 -0
  140. wingify/packages/storage/storage.py +39 -0
  141. wingify/resources/__init__.py +13 -0
  142. wingify/resources/debug-messages.json +21 -0
  143. wingify/resources/error-messages.json +62 -0
  144. wingify/resources/info-message.json +47 -0
  145. wingify/resources/trace-messages.json +1 -0
  146. wingify/resources/warn-messages.json +1 -0
  147. wingify/services/__init__.py +13 -0
  148. wingify/services/batch_event_queue.py +140 -0
  149. wingify/services/campaign_decision_service.py +268 -0
  150. wingify/services/hooks_manager.py +65 -0
  151. wingify/services/internal_events_sampling_service.py +62 -0
  152. wingify/services/settings_manager.py +293 -0
  153. wingify/services/storage_service.py +58 -0
  154. wingify/services/url_service.py +51 -0
  155. wingify/utils/__init__.py +13 -0
  156. wingify/utils/aliasing_util.py +108 -0
  157. wingify/utils/brand_context.py +26 -0
  158. wingify/utils/brand_util.py +37 -0
  159. wingify/utils/campaign_util.py +592 -0
  160. wingify/utils/data_type_util.py +125 -0
  161. wingify/utils/debugger_service_util.py +58 -0
  162. wingify/utils/decision_util.py +589 -0
  163. wingify/utils/event_util.py +85 -0
  164. wingify/utils/function_util.py +188 -0
  165. wingify/utils/gateway_service_util.py +179 -0
  166. wingify/utils/holdout_util.py +264 -0
  167. wingify/utils/impression_util.py +151 -0
  168. wingify/utils/internal_events_sampling_util.py +106 -0
  169. wingify/utils/log_message_util.py +95 -0
  170. wingify/utils/meg_util.py +561 -0
  171. wingify/utils/model_utils.py +136 -0
  172. wingify/utils/network_util.py +706 -0
  173. wingify/utils/rule_evaluation_util.py +102 -0
  174. wingify/utils/settings_util.py +39 -0
  175. wingify/utils/usage_stats_util.py +116 -0
  176. wingify/utils/uuid_util.py +81 -0
  177. wingify/vwo_client.py +21 -0
  178. wingify/wingify.py +159 -0
  179. wingify/wingify_builder.py +282 -0
  180. wingify/wingify_client.py +520 -0
  181. wingify_fme_python_sdk-1.70.0.dist-info/METADATA +1415 -0
  182. wingify_fme_python_sdk-1.70.0.dist-info/RECORD +186 -0
  183. wingify_fme_python_sdk-1.70.0.dist-info/WHEEL +5 -0
  184. wingify_fme_python_sdk-1.70.0.dist-info/licenses/LICENSE +202 -0
  185. wingify_fme_python_sdk-1.70.0.dist-info/licenses/NOTICE +18 -0
  186. wingify_fme_python_sdk-1.70.0.dist-info/top_level.txt +3 -0
@@ -0,0 +1,127 @@
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 List, Dict, Optional, Any
17
+ from ..campaign.campaign_model import CampaignModel
18
+ from ..campaign.feature_model import FeatureModel
19
+ from ...utils.model_utils import _parse_campaign, _parse_feature
20
+ import json
21
+ from ...constants.Constants import Constants
22
+ from ..campaign.holdout_model import HoldoutModel
23
+ from .internal_event_sampling_settings_model import AlwaysApplySampling, EventCategorySamplingRates
24
+
25
+
26
+ class SettingsModel:
27
+ def __init__(self, data: Dict):
28
+ # Parse and set attributes
29
+ self._features = [_parse_feature(f) for f in data["features"]]
30
+ self._account_id = data["accountId"]
31
+ self._groups = data.get("groups", {})
32
+ self._campaign_groups = data.get("campaignGroups", {})
33
+ self._campaigns = [_parse_campaign(c) for c in data["campaigns"]]
34
+ self._sdk_key = data["sdkKey"]
35
+ self._version = data["version"]
36
+ self._collection_prefix = data.get("collectionPrefix", None)
37
+ self._poll_interval = data.get("pollInterval", Constants.POLLING_INTERVAL)
38
+ self._is_web_connectivity_enabled = data.get("isWebConnectivityEnabled", True)
39
+ self._holdouts = [HoldoutModel(h) for h in data.get("holdouts", [])]
40
+ self._is_tracking_usage_enabled = data.get("isMAU", False)
41
+ self._sdk_meta_info = data.get("sdkMetaInfo", {})
42
+ self._usage_stats_account_id = data.get("usageStatsAccountId", None)
43
+ self._always_apply_sampling = AlwaysApplySampling(data.get("alwaysApplySampling", {})) if data.get("alwaysApplySampling") is not None else None
44
+ self._sampling = EventCategorySamplingRates(data.get("sampling", {})) if data.get("sampling") is not None else None
45
+
46
+ # Getter methods for accessing private attributes
47
+ def get_features(self) -> List[FeatureModel]:
48
+ return self._features
49
+
50
+ def get_account_id(self) -> int:
51
+ return self._account_id
52
+
53
+ def get_groups(self) -> Optional[Dict]:
54
+ return self._groups
55
+
56
+ def get_campaign_groups(self) -> Optional[Dict[str, int]]:
57
+ return self._campaign_groups
58
+
59
+ def get_campaigns(self) -> List[CampaignModel]:
60
+ return self._campaigns
61
+
62
+ def get_sdk_key(self) -> str:
63
+ return self._sdk_key
64
+
65
+ def get_version(self) -> int:
66
+ return self._version
67
+
68
+ def get_collection_prefix(self) -> Optional[str]:
69
+ return self._collection_prefix
70
+
71
+ # Setter methods for modifying private attributes
72
+ def set_features(self, value: List[FeatureModel]):
73
+ self._features = value
74
+
75
+ def set_account_id(self, value: int):
76
+ self._account_id = value
77
+
78
+ def set_groups(self, value: Dict):
79
+ self._groups = value
80
+
81
+ def set_campaign_groups(self, value: Dict[str, int]):
82
+ self._campaign_groups = value
83
+
84
+ def set_campaigns(self, value: List[CampaignModel]):
85
+ self._campaigns = value
86
+
87
+ def set_sdk_key(self, value: str):
88
+ self._sdk_key = value
89
+
90
+ def set_version(self, value: int):
91
+ self._version = value
92
+
93
+ def set_collection_prefix(self, value: Optional[str]):
94
+ self._collection_prefix = value
95
+
96
+ def set_poll_interval(self, value: int):
97
+ self._poll_interval = value
98
+
99
+ def get_poll_interval(self) -> int:
100
+ return self._poll_interval
101
+
102
+ def get_is_web_connectivity_enabled(self) -> bool:
103
+ return self._is_web_connectivity_enabled
104
+
105
+ def set_holdouts(self, value: List[HoldoutModel]):
106
+ self._holdouts = value
107
+
108
+ def get_holdouts(self) -> List[HoldoutModel]:
109
+ return self._holdouts if isinstance(self._holdouts, list) else []
110
+
111
+ def get_is_tracking_usage_enabled(self) -> bool:
112
+ return self._is_tracking_usage_enabled
113
+
114
+ def set_is_tracking_usage_enabled(self, value: bool):
115
+ self._is_tracking_usage_enabled = value
116
+
117
+ def get_sdk_meta_info(self) -> Dict[str, Any]:
118
+ return self._sdk_meta_info
119
+
120
+ def get_usage_stats_account_id(self) -> Optional[int]:
121
+ return self._usage_stats_account_id
122
+
123
+ def get_always_apply_sampling(self) -> Optional[AlwaysApplySampling]:
124
+ return self._always_apply_sampling
125
+
126
+ def get_sampling(self) -> Optional[EventCategorySamplingRates]:
127
+ return self._sampling
@@ -0,0 +1,13 @@
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.
@@ -0,0 +1,84 @@
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 Dict
17
+
18
+
19
+ class Storage:
20
+ def __init__(self, data: Dict):
21
+ """
22
+ Initialize the Storage model with the provided data dictionary.
23
+
24
+ :param data: A dictionary containing the storage attributes.
25
+ """
26
+ self._feature_key = data.get("featureKey", None)
27
+ self._user = data.get("user", None)
28
+ self._rollout_id = data.get("rolloutId", None)
29
+ self._rollout_key = data.get("rolloutKey", None)
30
+ self._rollout_variation_id = data.get("rolloutVariationId", None)
31
+ self._experiment_id = data.get("experimentId", None)
32
+ self._experiment_key = data.get("experimentKey", None)
33
+ self._experiment_variation_id = data.get("experimentVariationId", None)
34
+ self._is_in_holdout_id = data.get("isInHoldoutId", None)
35
+ self._not_in_holdout_id = data.get("notInHoldoutId", None)
36
+ # Getter methods for accessing private attributes
37
+ def get_feature_key(self) -> str:
38
+ return self._feature_key
39
+
40
+ def get_user(self) -> str:
41
+ return self._user
42
+
43
+ def get_rollout_id(self) -> int:
44
+ return self._rollout_id
45
+
46
+ def get_rollout_key(self) -> str:
47
+ return self._rollout_key
48
+
49
+ def get_rollout_variation_id(self) -> int:
50
+ return self._rollout_variation_id
51
+
52
+ def get_experiment_id(self) -> int:
53
+ return self._experiment_id
54
+
55
+ def get_experiment_key(self) -> str:
56
+ return self._experiment_key
57
+
58
+ def get_experiment_variation_id(self) -> int:
59
+ return self._experiment_variation_id
60
+
61
+ # Setter methods for modifying private attributes
62
+ def set_feature_key(self, value: str):
63
+ self._feature_key = value
64
+
65
+ def set_user(self, value: str):
66
+ self._user = value
67
+
68
+ def set_rollout_id(self, value: int):
69
+ self._rollout_id = value
70
+
71
+ def set_rollout_key(self, value: str):
72
+ self._rollout_key = value
73
+
74
+ def set_rollout_variation_id(self, value: int):
75
+ self._rollout_variation_id = value
76
+
77
+ def set_experiment_id(self, value: int):
78
+ self._experiment_id = value
79
+
80
+ def set_experiment_key(self, value: str):
81
+ self._experiment_key = value
82
+
83
+ def set_experiment_variation_id(self, value: int):
84
+ self._experiment_variation_id = value
@@ -0,0 +1,13 @@
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.
@@ -0,0 +1,113 @@
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 .context_vwo_model import ContextVWOModel
17
+ from typing import Any, Dict, List, Optional
18
+ from ...utils.data_type_util import is_object
19
+ from ...utils.uuid_util import get_uuid
20
+ from ...services.settings_manager import SettingsManager
21
+ from ...utils.function_util import get_current_unix_timestamp
22
+
23
+ class ContextModel:
24
+ def __init__(self, context: Dict):
25
+ self.id = context.get("id")
26
+ self.user_agent = context.get("user_agent", None)
27
+ self.ip_address = context.get("ip_address", None)
28
+ self.custom_variables = context.get("custom_variables", {})
29
+ self.variation_targeting_variables = context.get(
30
+ "variation_targeting_variables", {}
31
+ )
32
+ # Accept legacy _vwo or _wingify context keys for UA / device hints
33
+ vwo_context_data = context.get("_vwo") or context.get("_wingify")
34
+ self._vwo = ContextVWOModel(vwo_context_data) if vwo_context_data else None
35
+ self.post_segmentation_variables = context.get("post_segmentation_variables", [])
36
+ self.bucketingSeed = context.get("bucketingSeed")
37
+ self.platform_variables: Optional[Dict[str, Any]] = (
38
+ dict(context.get("platform_variables"))
39
+ if is_object(context.get("platform_variables"))
40
+ else None
41
+ )
42
+ self.session_id = context.get("session_id", None)
43
+ if self.session_id is None:
44
+ self.session_id = get_current_unix_timestamp()
45
+
46
+ # if uuid is provided in the context, use it, otherwise generate a new one
47
+ if context.get("uuid") is not None:
48
+ self._vwo_uuid = context.get("uuid")
49
+ else:
50
+ self._vwo_uuid = get_uuid(self.id, str(SettingsManager.get_instance().get_account_id()))
51
+
52
+ def get_id(self) -> str:
53
+ return str(self.id) if self.id is not None else None
54
+
55
+ def set_id(self, id: str) -> None:
56
+ self.id = id
57
+ self._vwo_uuid = get_uuid(self.id, str(SettingsManager.get_instance().get_account_id()))
58
+
59
+ def get_user_agent(self) -> str:
60
+ return self.user_agent
61
+
62
+ def get_ip_address(self) -> str:
63
+ return self.ip_address
64
+
65
+ def get_custom_variables(self) -> Dict:
66
+ return self.custom_variables
67
+
68
+ def set_custom_variables(self, custom_variables: Dict) -> None:
69
+ self.custom_variables = custom_variables
70
+
71
+ def get_variation_targeting_variables(self) -> Dict:
72
+ return self.variation_targeting_variables
73
+
74
+ def set_variation_targeting_variables(
75
+ self, variation_targeting_variables: Dict
76
+ ) -> None:
77
+ self.variation_targeting_variables = variation_targeting_variables
78
+
79
+ def get_vwo(self) -> ContextVWOModel:
80
+ return self._vwo
81
+
82
+ def set_vwo(self, vwo: ContextVWOModel) -> None:
83
+ self._vwo = vwo
84
+
85
+ def get_post_segmentation_variables(self) -> List[str]:
86
+ return self.post_segmentation_variables
87
+
88
+ def set_post_segmentation_variables(self, post_segmentation_variables: List[str]) -> None:
89
+ self.post_segmentation_variables = post_segmentation_variables
90
+
91
+
92
+ def get_vwo_uuid(self) -> str:
93
+ return self._vwo_uuid
94
+
95
+ def set_vwo_uuid(self, vwo_uuid: str) -> None:
96
+ self._vwo_uuid = vwo_uuid
97
+
98
+ def get_session_id(self) -> int:
99
+ return self.session_id
100
+
101
+ def set_session_id(self, session_id: int) -> None:
102
+ self.session_id = session_id
103
+
104
+ def get_bucketing_seed(self) -> str:
105
+ return self.bucketingSeed
106
+
107
+ def get_platform_variables(self) -> Optional[Dict[str, Any]]:
108
+ return self.platform_variables
109
+
110
+ def set_platform_variables(self, platform_variables: Optional[Dict[str, Any]]) -> None:
111
+ self.platform_variables = (
112
+ dict(platform_variables) if is_object(platform_variables) else None
113
+ )
@@ -0,0 +1,34 @@
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 Dict
17
+
18
+
19
+ class ContextVWOModel:
20
+ def __init__(self, context: Dict = None):
21
+ # Initialize attributes with default empty dictionaries
22
+ self.location = {}
23
+ self.user_agent = {}
24
+
25
+ # If context is provided, populate attributes
26
+ if context:
27
+ self.location = context.get("location", {})
28
+ self.user_agent = context.get("userAgent", {})
29
+
30
+ def get_location(self) -> Dict:
31
+ return self.location
32
+
33
+ def get_ua_info(self) -> Dict:
34
+ return self.user_agent
@@ -0,0 +1,47 @@
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 ..campaign.variable_model import VariableModel
17
+ from typing import List, Any, Dict
18
+
19
+
20
+ class GetFlag:
21
+ def __init__(self, is_enabled: bool, variables: List[VariableModel], session_id: int, uuid: str):
22
+ self._uuid = uuid
23
+ self._is_enabled = is_enabled
24
+ self._variables = variables
25
+ self._session_id = session_id
26
+
27
+ def get_uuid(self) -> str:
28
+ return self._uuid
29
+
30
+ def is_enabled(self) -> bool:
31
+ return self._is_enabled
32
+
33
+ def get_variables(self) -> List[Dict[str, Any]]:
34
+ # convert variables to Dict
35
+ variables = []
36
+ for variable in self._variables:
37
+ variables.append(variable.to_dict())
38
+ return variables
39
+
40
+ def get_variable(self, variable_key: str, default_value: Any = None) -> str:
41
+ for variable in self._variables:
42
+ if variable.get_key() == variable_key:
43
+ return variable.get_value()
44
+ return default_value
45
+
46
+ def get_session_id(self) -> int:
47
+ return self._session_id
@@ -0,0 +1,21 @@
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
+ """Legacy type alias used internally — same as WingifyOptionsModel."""
16
+
17
+ from wingify.models.wingify_options_model import WingifyOptionsModel
18
+
19
+ VWOOptionsModel = WingifyOptionsModel
20
+
21
+ __all__ = ["VWOOptionsModel", "WingifyOptionsModel"]
@@ -0,0 +1,129 @@
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
+ from typing import Dict, Optional
16
+
17
+ from wingify.models.batch_event_data import BatchEventData
18
+
19
+
20
+ class WingifyOptionsModel:
21
+ """
22
+ Canonical SDK options model. Accepts both Wingify and legacy VWO option keys
23
+ for builder and metadata fields.
24
+ """
25
+
26
+ def __init__(self, options: Dict):
27
+ self.accountId = options.get("accountId", None)
28
+ self.sdkKey = options.get("sdkKey", None)
29
+ self.isDevelopmentMode = options.get("isDevelopmentMode", False)
30
+ self.storage = options.get("storage", None)
31
+ self.gateway_service = options.get("gateway_service", None)
32
+ self.poll_interval = options.get("poll_interval", None)
33
+ self.logger = options.get("logger", None)
34
+ self.segmentation = options.get("segmentation", None)
35
+ self.integrations = options.get("integrations", None)
36
+ self.network = options.get("network", None)
37
+
38
+ # Builder: prefer wingifyBuilder, fall back to legacy vwoBuilder
39
+ self.wingifyBuilder = options.get("wingifyBuilder") or options.get("vwoBuilder")
40
+ self.vwoBuilder = self.wingifyBuilder
41
+
42
+ self.is_usage_stats_disabled = options.get("is_usage_stats_disabled", False)
43
+
44
+ # Meta: prefer _wingify_meta, fall back to legacy _vwo_meta
45
+ self._wingify_meta = options.get("_wingify_meta") or options.get("_vwo_meta")
46
+ self._vwo_meta = self._wingify_meta
47
+
48
+ self.isAliasingEnabled = options.get("isAliasingEnabled", False)
49
+ self.proxy_url = options.get("proxy_url", None)
50
+
51
+ batch_event_data = options.get("batch_event_data", None)
52
+ if batch_event_data:
53
+ self.batchEventData = BatchEventData(
54
+ events_per_request=batch_event_data.get("events_per_request"),
55
+ request_time_interval=batch_event_data.get("request_time_interval"),
56
+ flush_callback=batch_event_data.get("flush_callback", None),
57
+ )
58
+ else:
59
+ self.batchEventData = None
60
+
61
+ def get_account_id(self) -> str:
62
+ return self.accountId
63
+
64
+ def get_sdk_key(self) -> str:
65
+ return self.sdkKey
66
+
67
+ def get_is_development_mode(self) -> bool:
68
+ return self.isDevelopmentMode
69
+
70
+ def get_storage_service(self):
71
+ return self.storage
72
+
73
+ def get_gateway_service(self):
74
+ return self.gateway_service
75
+
76
+ def get_poll_interval(self) -> int:
77
+ return self.poll_interval
78
+
79
+ def get_logger(self):
80
+ return self.logger
81
+
82
+ def get_segmentation(self):
83
+ return self.segmentation
84
+
85
+ def get_integrations(self):
86
+ return self.integrations
87
+
88
+ def get_network(self):
89
+ return self.network
90
+
91
+ def get_wingify_builder(self):
92
+ return self.wingifyBuilder
93
+
94
+ def get_vwo_builder(self):
95
+ """Legacy alias for get_wingify_builder()."""
96
+ return self.wingifyBuilder
97
+
98
+ def get_batch_event_data(self):
99
+ return self.batchEventData
100
+
101
+ def get_is_usage_stats_disabled(self) -> bool:
102
+ return self.is_usage_stats_disabled
103
+
104
+ def get_sdk_meta(self) -> Dict:
105
+ return self._wingify_meta
106
+
107
+ def get_vwo_meta(self) -> Dict:
108
+ """Legacy alias for get_sdk_meta()."""
109
+ return self._wingify_meta
110
+
111
+ def get_wingify_meta(self) -> Dict:
112
+ return self._wingify_meta
113
+
114
+ def get_sdk_name(self) -> Optional[str]:
115
+ meta = self._wingify_meta or {}
116
+ return meta.get("_wingify_sdkName") or meta.get("_vwo_sdkName")
117
+
118
+ def get_sdk_version(self) -> Optional[str]:
119
+ meta = self._wingify_meta or {}
120
+ return meta.get("_wingify_sdkVersion") or meta.get("_vwo_sdkVersion")
121
+
122
+ def get_is_aliasing_enabled(self) -> bool:
123
+ return self.isAliasingEnabled
124
+
125
+ def set_is_aliasing_enabled(self, is_aliasing_enabled: bool) -> None:
126
+ self.isAliasingEnabled = is_aliasing_enabled
127
+
128
+ def get_proxy_url(self) -> str:
129
+ return self.proxy_url
@@ -0,0 +1,13 @@
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.
@@ -0,0 +1,13 @@
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.