unrealon 1.1.5__py3-none-any.whl → 2.0.4__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 (146) hide show
  1. {unrealon-1.1.5.dist-info/licenses → unrealon-2.0.4.dist-info}/LICENSE +1 -1
  2. unrealon-2.0.4.dist-info/METADATA +491 -0
  3. unrealon-2.0.4.dist-info/RECORD +129 -0
  4. {unrealon-1.1.5.dist-info → unrealon-2.0.4.dist-info}/WHEEL +2 -1
  5. unrealon-2.0.4.dist-info/entry_points.txt +3 -0
  6. unrealon-2.0.4.dist-info/top_level.txt +3 -0
  7. unrealon_browser/__init__.py +5 -2
  8. unrealon_browser/cli/browser_cli.py +18 -9
  9. unrealon_browser/cli/interactive_mode.py +18 -7
  10. unrealon_browser/core/browser_manager.py +76 -13
  11. unrealon_browser/dto/__init__.py +21 -0
  12. unrealon_browser/dto/bot_detection.py +175 -0
  13. unrealon_browser/dto/models/config.py +14 -1
  14. unrealon_browser/managers/__init__.py +4 -1
  15. unrealon_browser/managers/logger_bridge.py +3 -6
  16. unrealon_browser/managers/page_wait_manager.py +198 -0
  17. unrealon_browser/stealth/__init__.py +27 -0
  18. unrealon_browser/stealth/bypass_techniques.pyc +0 -0
  19. unrealon_browser/stealth/manager.pyc +0 -0
  20. unrealon_browser/stealth/nodriver_stealth.pyc +0 -0
  21. unrealon_browser/stealth/playwright_stealth.pyc +0 -0
  22. unrealon_browser/stealth/scanner_tester.pyc +0 -0
  23. unrealon_browser/stealth/undetected_chrome.pyc +0 -0
  24. unrealon_core/__init__.py +160 -0
  25. unrealon_core/config/__init__.py +16 -0
  26. unrealon_core/config/environment.py +98 -0
  27. unrealon_core/config/urls.py +93 -0
  28. unrealon_core/enums/__init__.py +24 -0
  29. unrealon_core/enums/status.py +216 -0
  30. unrealon_core/enums/types.py +240 -0
  31. unrealon_core/error_handling/__init__.py +45 -0
  32. unrealon_core/error_handling/circuit_breaker.py +292 -0
  33. unrealon_core/error_handling/error_context.py +324 -0
  34. unrealon_core/error_handling/recovery.py +371 -0
  35. unrealon_core/error_handling/retry.py +268 -0
  36. unrealon_core/exceptions/__init__.py +46 -0
  37. unrealon_core/exceptions/base.py +292 -0
  38. unrealon_core/exceptions/communication.py +22 -0
  39. unrealon_core/exceptions/driver.py +11 -0
  40. unrealon_core/exceptions/proxy.py +11 -0
  41. unrealon_core/exceptions/task.py +12 -0
  42. unrealon_core/exceptions/validation.py +17 -0
  43. unrealon_core/models/__init__.py +98 -0
  44. unrealon_core/models/arq_context.py +252 -0
  45. unrealon_core/models/arq_responses.py +125 -0
  46. unrealon_core/models/base.py +291 -0
  47. unrealon_core/models/bridge_stats.py +58 -0
  48. unrealon_core/models/communication.py +39 -0
  49. unrealon_core/models/config.py +47 -0
  50. unrealon_core/models/connection_stats.py +47 -0
  51. unrealon_core/models/driver.py +30 -0
  52. unrealon_core/models/driver_details.py +98 -0
  53. unrealon_core/models/logging.py +28 -0
  54. unrealon_core/models/task.py +21 -0
  55. unrealon_core/models/typed_responses.py +210 -0
  56. unrealon_core/models/websocket/__init__.py +91 -0
  57. unrealon_core/models/websocket/base.py +49 -0
  58. unrealon_core/models/websocket/config.py +200 -0
  59. unrealon_core/models/websocket/driver.py +215 -0
  60. unrealon_core/models/websocket/errors.py +138 -0
  61. unrealon_core/models/websocket/heartbeat.py +100 -0
  62. unrealon_core/models/websocket/logging.py +261 -0
  63. unrealon_core/models/websocket/proxy.py +496 -0
  64. unrealon_core/models/websocket/tasks.py +275 -0
  65. unrealon_core/models/websocket/utils.py +153 -0
  66. unrealon_core/models/websocket_session.py +144 -0
  67. unrealon_core/monitoring/__init__.py +43 -0
  68. unrealon_core/monitoring/alerts.py +398 -0
  69. unrealon_core/monitoring/dashboard.py +307 -0
  70. unrealon_core/monitoring/health_check.py +354 -0
  71. unrealon_core/monitoring/metrics.py +352 -0
  72. unrealon_core/utils/__init__.py +11 -0
  73. unrealon_core/utils/time.py +61 -0
  74. unrealon_core/version.py +219 -0
  75. unrealon_driver/__init__.py +88 -50
  76. unrealon_driver/core_module/__init__.py +34 -0
  77. unrealon_driver/core_module/base.py +184 -0
  78. unrealon_driver/core_module/config.py +30 -0
  79. unrealon_driver/core_module/event_manager.py +127 -0
  80. unrealon_driver/core_module/protocols.py +98 -0
  81. unrealon_driver/core_module/registry.py +146 -0
  82. unrealon_driver/decorators/__init__.py +15 -0
  83. unrealon_driver/decorators/retry.py +117 -0
  84. unrealon_driver/decorators/schedule.py +137 -0
  85. unrealon_driver/decorators/task.py +61 -0
  86. unrealon_driver/decorators/timing.py +132 -0
  87. unrealon_driver/driver/__init__.py +20 -0
  88. unrealon_driver/driver/communication/__init__.py +10 -0
  89. unrealon_driver/driver/communication/session.py +203 -0
  90. unrealon_driver/driver/communication/websocket_client.py +197 -0
  91. unrealon_driver/driver/core/__init__.py +10 -0
  92. unrealon_driver/driver/core/config.py +85 -0
  93. unrealon_driver/driver/core/driver.py +221 -0
  94. unrealon_driver/driver/factory/__init__.py +9 -0
  95. unrealon_driver/driver/factory/manager_factory.py +130 -0
  96. unrealon_driver/driver/lifecycle/__init__.py +11 -0
  97. unrealon_driver/driver/lifecycle/daemon.py +76 -0
  98. unrealon_driver/driver/lifecycle/initialization.py +97 -0
  99. unrealon_driver/driver/lifecycle/shutdown.py +48 -0
  100. unrealon_driver/driver/monitoring/__init__.py +9 -0
  101. unrealon_driver/driver/monitoring/health.py +63 -0
  102. unrealon_driver/driver/utilities/__init__.py +10 -0
  103. unrealon_driver/driver/utilities/logging.py +51 -0
  104. unrealon_driver/driver/utilities/serialization.py +61 -0
  105. unrealon_driver/managers/__init__.py +32 -0
  106. unrealon_driver/managers/base.py +174 -0
  107. unrealon_driver/managers/browser.py +98 -0
  108. unrealon_driver/managers/cache.py +116 -0
  109. unrealon_driver/managers/http.py +107 -0
  110. unrealon_driver/managers/logger.py +286 -0
  111. unrealon_driver/managers/proxy.py +99 -0
  112. unrealon_driver/managers/registry.py +87 -0
  113. unrealon_driver/managers/threading.py +54 -0
  114. unrealon_driver/managers/update.py +107 -0
  115. unrealon_driver/utils/__init__.py +9 -0
  116. unrealon_driver/utils/time.py +10 -0
  117. unrealon/__init__.py +0 -40
  118. unrealon-1.1.5.dist-info/METADATA +0 -621
  119. unrealon-1.1.5.dist-info/RECORD +0 -54
  120. unrealon-1.1.5.dist-info/entry_points.txt +0 -9
  121. unrealon_browser/managers/stealth.py +0 -388
  122. unrealon_driver/exceptions.py +0 -33
  123. unrealon_driver/html_analyzer/__init__.py +0 -32
  124. unrealon_driver/html_analyzer/cleaner.py +0 -657
  125. unrealon_driver/html_analyzer/config.py +0 -64
  126. unrealon_driver/html_analyzer/manager.py +0 -247
  127. unrealon_driver/html_analyzer/models.py +0 -115
  128. unrealon_driver/html_analyzer/websocket_analyzer.py +0 -157
  129. unrealon_driver/models/__init__.py +0 -31
  130. unrealon_driver/models/websocket.py +0 -98
  131. unrealon_driver/parser/__init__.py +0 -36
  132. unrealon_driver/parser/cli_manager.py +0 -142
  133. unrealon_driver/parser/daemon_manager.py +0 -403
  134. unrealon_driver/parser/managers/__init__.py +0 -25
  135. unrealon_driver/parser/managers/config.py +0 -293
  136. unrealon_driver/parser/managers/error.py +0 -412
  137. unrealon_driver/parser/managers/result.py +0 -321
  138. unrealon_driver/parser/parser_manager.py +0 -458
  139. unrealon_driver/smart_logging/__init__.py +0 -24
  140. unrealon_driver/smart_logging/models.py +0 -44
  141. unrealon_driver/smart_logging/smart_logger.py +0 -406
  142. unrealon_driver/smart_logging/unified_logger.py +0 -525
  143. unrealon_driver/websocket/__init__.py +0 -31
  144. unrealon_driver/websocket/client.py +0 -249
  145. unrealon_driver/websocket/config.py +0 -188
  146. unrealon_driver/websocket/manager.py +0 -90
@@ -0,0 +1,292 @@
1
+ """
2
+ Base exceptions for UnrealOn system.
3
+
4
+ Provides the foundation exception classes that all other
5
+ UnrealOn exceptions inherit from. Includes error codes,
6
+ context information, and structured error handling.
7
+
8
+ Phase 1: Foundation exception hierarchy
9
+ """
10
+
11
+ from typing import Optional, Dict, Any, Union
12
+ from unrealon_core.utils.time import utc_now
13
+
14
+ class UnrealOnError(Exception):
15
+ """
16
+ Base exception for all UnrealOn errors.
17
+
18
+ Provides:
19
+ - Error codes for programmatic handling
20
+ - Context information for debugging
21
+ - Structured error data
22
+ - Timestamp tracking
23
+ """
24
+
25
+ def __init__(
26
+ self,
27
+ message: str,
28
+ error_code: Optional[str] = None,
29
+ context: Optional[Dict[str, Any]] = None,
30
+ cause: Optional[Exception] = None
31
+ ):
32
+ """
33
+ Initialize UnrealOn error.
34
+
35
+ Args:
36
+ message: Human-readable error message
37
+ error_code: Machine-readable error code
38
+ context: Additional context information
39
+ cause: Original exception that caused this error
40
+ """
41
+ super().__init__(message)
42
+ self.message = message
43
+ self.error_code = error_code or self._get_default_error_code()
44
+ self.context = context or {}
45
+ self.cause = cause
46
+ self.timestamp = utc_now()
47
+
48
+ # Set the cause for proper exception chaining
49
+ if cause:
50
+ self.__cause__ = cause
51
+
52
+ def _get_default_error_code(self) -> str:
53
+ """Get default error code based on exception class name."""
54
+ class_name = self.__class__.__name__
55
+ # Convert CamelCase to UPPER_SNAKE_CASE
56
+ import re
57
+ error_code = re.sub('([a-z0-9])([A-Z])', r'\1_\2', class_name).upper()
58
+ return error_code
59
+
60
+ def to_dict(self) -> Dict[str, Any]:
61
+ """Convert exception to dictionary for serialization."""
62
+ return {
63
+ 'error_type': self.__class__.__name__,
64
+ 'error_code': self.error_code,
65
+ 'message': self.message,
66
+ 'context': self.context,
67
+ 'timestamp': self.timestamp.isoformat(),
68
+ 'cause': str(self.cause) if self.cause else None
69
+ }
70
+
71
+ def add_context(self, key: str, value: Any) -> 'UnrealOnError':
72
+ """Add context information to the error."""
73
+ self.context[key] = value
74
+ return self
75
+
76
+ def with_context(self, **context) -> 'UnrealOnError':
77
+ """Add multiple context items to the error."""
78
+ self.context.update(context)
79
+ return self
80
+
81
+ def __str__(self) -> str:
82
+ """String representation of the error."""
83
+ parts = [f"[{self.error_code}] {self.message}"]
84
+
85
+ if self.context:
86
+ context_str = ", ".join(f"{k}={v}" for k, v in self.context.items())
87
+ parts.append(f"Context: {context_str}")
88
+
89
+ if self.cause:
90
+ parts.append(f"Caused by: {self.cause}")
91
+
92
+ return " | ".join(parts)
93
+
94
+ def __repr__(self) -> str:
95
+ """Detailed representation of the error."""
96
+ return (
97
+ f"{self.__class__.__name__}("
98
+ f"message='{self.message}', "
99
+ f"error_code='{self.error_code}', "
100
+ f"context={self.context}, "
101
+ f"cause={self.cause!r})"
102
+ )
103
+
104
+
105
+ class UnrealOnWarning(UserWarning):
106
+ """
107
+ Base warning for UnrealOn system.
108
+
109
+ Used for non-fatal issues that should be logged
110
+ but don't prevent operation from continuing.
111
+ """
112
+
113
+ def __init__(
114
+ self,
115
+ message: str,
116
+ warning_code: Optional[str] = None,
117
+ context: Optional[Dict[str, Any]] = None
118
+ ):
119
+ """
120
+ Initialize UnrealOn warning.
121
+
122
+ Args:
123
+ message: Human-readable warning message
124
+ warning_code: Machine-readable warning code
125
+ context: Additional context information
126
+ """
127
+ super().__init__(message)
128
+ self.message = message
129
+ self.warning_code = warning_code or self._get_default_warning_code()
130
+ self.context = context or {}
131
+ self.timestamp = utc_now()
132
+
133
+ def _get_default_warning_code(self) -> str:
134
+ """Get default warning code based on class name."""
135
+ class_name = self.__class__.__name__
136
+ import re
137
+ warning_code = re.sub('([a-z0-9])([A-Z])', r'\1_\2', class_name).upper()
138
+ return warning_code
139
+
140
+ def to_dict(self) -> Dict[str, Any]:
141
+ """Convert warning to dictionary for serialization."""
142
+ return {
143
+ 'warning_type': self.__class__.__name__,
144
+ 'warning_code': self.warning_code,
145
+ 'message': self.message,
146
+ 'context': self.context,
147
+ 'timestamp': self.timestamp.isoformat()
148
+ }
149
+
150
+
151
+ class UnrealOnTimeoutError(UnrealOnError):
152
+ """
153
+ Base timeout error for operations that exceed time limits.
154
+
155
+ Used when operations take longer than expected or configured
156
+ timeout values are exceeded.
157
+ """
158
+
159
+ def __init__(
160
+ self,
161
+ message: str,
162
+ timeout_seconds: Optional[float] = None,
163
+ operation: Optional[str] = None,
164
+ **kwargs
165
+ ):
166
+ """
167
+ Initialize timeout error.
168
+
169
+ Args:
170
+ message: Error message
171
+ timeout_seconds: The timeout value that was exceeded
172
+ operation: Name of the operation that timed out
173
+ **kwargs: Additional arguments for base class
174
+ """
175
+ super().__init__(message, **kwargs)
176
+
177
+ if timeout_seconds is not None:
178
+ self.add_context('timeout_seconds', timeout_seconds)
179
+
180
+ if operation:
181
+ self.add_context('operation', operation)
182
+
183
+
184
+ class UnrealOnConfigurationError(UnrealOnError):
185
+ """
186
+ Configuration-related errors.
187
+
188
+ Used when there are issues with system configuration,
189
+ invalid settings, or missing required configuration.
190
+ """
191
+
192
+ def __init__(
193
+ self,
194
+ message: str,
195
+ config_key: Optional[str] = None,
196
+ config_value: Optional[Any] = None,
197
+ **kwargs
198
+ ):
199
+ """
200
+ Initialize configuration error.
201
+
202
+ Args:
203
+ message: Error message
204
+ config_key: The configuration key that caused the error
205
+ config_value: The invalid configuration value
206
+ **kwargs: Additional arguments for base class
207
+ """
208
+ super().__init__(message, **kwargs)
209
+
210
+ if config_key:
211
+ self.add_context('config_key', config_key)
212
+
213
+ if config_value is not None:
214
+ self.add_context('config_value', str(config_value))
215
+
216
+
217
+ class UnrealOnRetryableError(UnrealOnError):
218
+ """
219
+ Base class for errors that can be retried.
220
+
221
+ Used for temporary failures that might succeed
222
+ if the operation is attempted again.
223
+ """
224
+
225
+ def __init__(
226
+ self,
227
+ message: str,
228
+ retry_after: Optional[float] = None,
229
+ max_retries: Optional[int] = None,
230
+ **kwargs
231
+ ):
232
+ """
233
+ Initialize retryable error.
234
+
235
+ Args:
236
+ message: Error message
237
+ retry_after: Suggested delay before retry (seconds)
238
+ max_retries: Maximum number of retries recommended
239
+ **kwargs: Additional arguments for base class
240
+ """
241
+ super().__init__(message, **kwargs)
242
+
243
+ if retry_after is not None:
244
+ self.add_context('retry_after', retry_after)
245
+
246
+ if max_retries is not None:
247
+ self.add_context('max_retries', max_retries)
248
+
249
+ def should_retry(self, attempt_count: int) -> bool:
250
+ """
251
+ Check if the operation should be retried.
252
+
253
+ Args:
254
+ attempt_count: Number of attempts already made
255
+
256
+ Returns:
257
+ True if retry should be attempted
258
+ """
259
+ max_retries = self.context.get('max_retries')
260
+ if max_retries is None:
261
+ return True # No limit specified
262
+
263
+ return attempt_count < max_retries
264
+
265
+ def get_retry_delay(self, attempt_count: int) -> float:
266
+ """
267
+ Get suggested delay before retry.
268
+
269
+ Args:
270
+ attempt_count: Number of attempts already made
271
+
272
+ Returns:
273
+ Delay in seconds
274
+ """
275
+ base_delay = self.context.get('retry_after', 1.0)
276
+
277
+ # Exponential backoff: delay = base_delay * (2 ^ attempt_count)
278
+ return base_delay * (2 ** min(attempt_count, 6)) # Cap at 2^6 = 64x
279
+
280
+
281
+ class UnrealOnFatalError(UnrealOnError):
282
+ """
283
+ Fatal errors that should stop system operation.
284
+
285
+ Used for critical errors that indicate the system
286
+ cannot continue operating safely.
287
+ """
288
+
289
+ def __init__(self, message: str, **kwargs):
290
+ """Initialize fatal error."""
291
+ super().__init__(message, **kwargs)
292
+ self.add_context('fatal', True)
@@ -0,0 +1,22 @@
1
+ """
2
+ Communication exceptions for UnrealOn system.
3
+
4
+ Phase 1: Basic communication exceptions
5
+ """
6
+
7
+ from .base import UnrealOnError, UnrealOnTimeoutError
8
+
9
+
10
+ class CommunicationError(UnrealOnError):
11
+ """Base communication error."""
12
+ pass
13
+
14
+
15
+ class WebSocketError(CommunicationError):
16
+ """WebSocket communication error."""
17
+ pass
18
+
19
+
20
+ class RPCError(CommunicationError):
21
+ """RPC communication error."""
22
+ pass
@@ -0,0 +1,11 @@
1
+ """Driver exceptions - Phase 1 stubs."""
2
+ from .base import UnrealOnError, UnrealOnTimeoutError
3
+
4
+ class DriverError(UnrealOnError):
5
+ pass
6
+
7
+ class DriverNotFoundError(DriverError):
8
+ pass
9
+
10
+ class DriverTimeoutError(UnrealOnTimeoutError):
11
+ pass
@@ -0,0 +1,11 @@
1
+ """Proxy exceptions - Phase 1 stubs."""
2
+ from .base import UnrealOnError, UnrealOnTimeoutError
3
+
4
+ class ProxyError(UnrealOnError):
5
+ pass
6
+
7
+ class ProxyNotAvailableError(ProxyError):
8
+ pass
9
+
10
+ class ProxyTimeoutError(UnrealOnTimeoutError):
11
+ pass
@@ -0,0 +1,12 @@
1
+ """Task exceptions - Phase 1 stubs."""
2
+ from .base import UnrealOnError, UnrealOnTimeoutError
3
+ from .validation import ValidationError
4
+
5
+ class TaskError(UnrealOnError):
6
+ pass
7
+
8
+ class TaskTimeoutError(UnrealOnTimeoutError):
9
+ pass
10
+
11
+ class TaskValidationError(ValidationError):
12
+ pass
@@ -0,0 +1,17 @@
1
+ """
2
+ Validation exceptions for UnrealOn system.
3
+
4
+ Phase 1: Basic validation exceptions
5
+ """
6
+
7
+ from .base import UnrealOnError, UnrealOnConfigurationError
8
+
9
+
10
+ class ValidationError(UnrealOnError):
11
+ """Validation error for invalid data."""
12
+ pass
13
+
14
+
15
+ class ConfigurationError(UnrealOnConfigurationError):
16
+ """Configuration validation error."""
17
+ pass
@@ -0,0 +1,98 @@
1
+ """
2
+ UnrealOn Core Models
3
+
4
+ All Pydantic models used across the UnrealOn system.
5
+ These models provide strict validation and serialization for:
6
+ - WebSocket communication
7
+ - RPC calls
8
+ - Database operations
9
+ - Configuration management
10
+
11
+ Phase 1: Foundation models with 100% validation coverage
12
+ """
13
+
14
+ from .base import (
15
+ UnrealOnBaseModel,
16
+ TimestampedModel,
17
+ IdentifiedModel,
18
+ StatusModel,
19
+ MetadataModel,
20
+ FullBaseModel,
21
+ SimpleBaseModel
22
+ )
23
+
24
+ from .communication import (
25
+ WebSocketMessage
26
+ )
27
+
28
+ from .driver import (
29
+ DriverInfo,
30
+ DriverConfig,
31
+ DriverCapability
32
+ )
33
+
34
+ from .task import (
35
+ TaskAssignmentData,
36
+ TaskResultData,
37
+ TaskParameters,
38
+ TaskMetadata
39
+ )
40
+
41
+ # Proxy models moved to websocket.proxy
42
+
43
+ from .logging import (
44
+ LogEntry,
45
+ LogQuery,
46
+ LogMetrics
47
+ )
48
+
49
+ from .config import (
50
+ SystemConfig,
51
+ HttpConfig,
52
+ ProxyConfig,
53
+ BrowserConfig,
54
+ LoggingConfig,
55
+ CacheConfig,
56
+ ThreadConfig
57
+ )
58
+
59
+ __all__ = [
60
+ # Base models
61
+ "UnrealOnBaseModel",
62
+ "TimestampedModel",
63
+ "IdentifiedModel",
64
+ "StatusModel",
65
+ "MetadataModel",
66
+ "FullBaseModel",
67
+ "SimpleBaseModel",
68
+
69
+ # Communication models
70
+ "WebSocketMessage",
71
+
72
+ # Driver models
73
+ "DriverInfo",
74
+ "DriverConfig",
75
+ "DriverCapability",
76
+
77
+ # Task models
78
+ "TaskAssignmentData",
79
+ "TaskResultData",
80
+ "TaskParameters",
81
+ "TaskMetadata",
82
+
83
+ # Proxy models moved to websocket.proxy
84
+
85
+ # Logging models
86
+ "LogEntry",
87
+ "LogQuery",
88
+ "LogMetrics",
89
+
90
+ # Configuration models
91
+ "SystemConfig",
92
+ "HttpConfig",
93
+ "ProxyConfig",
94
+ "BrowserConfig",
95
+ "LoggingConfig",
96
+ "CacheConfig",
97
+ "ThreadConfig",
98
+ ]