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,261 @@
1
+ """
2
+ Logging WebSocket Models.
3
+
4
+ Strictly typed models for log entries and batches.
5
+ No raw dictionaries - all data structures are Pydantic models.
6
+
7
+ Phase 2: Core Systems - WebSocket Bridge
8
+ """
9
+
10
+ from typing import List, Optional
11
+ from pydantic import Field, ConfigDict, field_validator
12
+
13
+ from ..base import UnrealOnBaseModel
14
+ from .base import WebSocketMessage, MessageType
15
+
16
+
17
+ class LogContext(UnrealOnBaseModel):
18
+ """Log context data - strictly typed for centralized logging."""
19
+
20
+ model_config = ConfigDict(
21
+ validate_assignment=True,
22
+ extra="forbid"
23
+ )
24
+
25
+ # Task context
26
+ task_id: Optional[str] = Field(
27
+ default=None,
28
+ max_length=100,
29
+ description="Associated task ID"
30
+ )
31
+
32
+ url: Optional[str] = Field(
33
+ default=None,
34
+ max_length=2000,
35
+ description="Associated URL"
36
+ )
37
+
38
+ # Performance metrics
39
+ duration_ms: Optional[float] = Field(
40
+ default=None,
41
+ ge=0.0,
42
+ description="Operation duration in milliseconds"
43
+ )
44
+
45
+ memory_usage_mb: Optional[float] = Field(
46
+ default=None,
47
+ ge=0.0,
48
+ description="Memory usage in MB"
49
+ )
50
+
51
+ cpu_usage_percent: Optional[float] = Field(
52
+ default=None,
53
+ ge=0.0,
54
+ le=100.0,
55
+ description="CPU usage percentage"
56
+ )
57
+
58
+ # Error context
59
+ error_code: Optional[str] = Field(
60
+ default=None,
61
+ max_length=50,
62
+ description="Error code if applicable"
63
+ )
64
+
65
+ stack_trace: Optional[str] = Field(
66
+ default=None,
67
+ max_length=5000,
68
+ description="Stack trace for errors"
69
+ )
70
+
71
+ # Network context
72
+ user_agent: Optional[str] = Field(
73
+ default=None,
74
+ max_length=500,
75
+ description="User agent used"
76
+ )
77
+
78
+ proxy_id: Optional[str] = Field(
79
+ default=None,
80
+ max_length=100,
81
+ description="Proxy ID used"
82
+ )
83
+
84
+ response_code: Optional[int] = Field(
85
+ default=None,
86
+ ge=100,
87
+ le=599,
88
+ description="HTTP response code"
89
+ )
90
+
91
+ # Driver context
92
+ driver_version: Optional[str] = Field(
93
+ default=None,
94
+ max_length=50,
95
+ description="Driver version"
96
+ )
97
+
98
+ session_id: Optional[str] = Field(
99
+ default=None,
100
+ max_length=100,
101
+ description="Driver session ID"
102
+ )
103
+
104
+
105
+ class LogEntryData(UnrealOnBaseModel):
106
+ """Log entry data payload - strictly typed for centralized logging."""
107
+
108
+ model_config = ConfigDict(
109
+ validate_assignment=True,
110
+ extra="forbid"
111
+ )
112
+
113
+ # Core log fields
114
+ level: str = Field(
115
+ pattern=r"^(DEBUG|INFO|WARNING|ERROR|CRITICAL)$",
116
+ description="Log level"
117
+ )
118
+
119
+ message: str = Field(
120
+ min_length=1,
121
+ max_length=2000,
122
+ description="Log message"
123
+ )
124
+
125
+ timestamp: str = Field(
126
+ description="Log timestamp in ISO format"
127
+ )
128
+
129
+ # Source identification
130
+ logger_name: str = Field(
131
+ default="driver",
132
+ min_length=1,
133
+ max_length=100,
134
+ description="Logger name"
135
+ )
136
+
137
+ module: Optional[str] = Field(
138
+ default=None,
139
+ max_length=200,
140
+ description="Module that generated the log"
141
+ )
142
+
143
+ function_name: Optional[str] = Field(
144
+ default=None,
145
+ max_length=100,
146
+ description="Function that generated the log"
147
+ )
148
+
149
+ line_number: Optional[int] = Field(
150
+ default=None,
151
+ ge=1,
152
+ description="Line number where log was generated"
153
+ )
154
+
155
+ # Driver identification
156
+ driver_id: str = Field(
157
+ min_length=1,
158
+ max_length=100,
159
+ description="Unique driver identifier"
160
+ )
161
+
162
+ driver_type: str = Field(
163
+ default="unrealon_driver",
164
+ max_length=50,
165
+ description="Type of driver"
166
+ )
167
+
168
+ # Environment
169
+ environment: str = Field(
170
+ default="production",
171
+ pattern=r"^(development|staging|production)$",
172
+ description="Environment where log was generated"
173
+ )
174
+
175
+ # Rich context
176
+ context: LogContext = Field(
177
+ default_factory=LogContext,
178
+ description="Additional log context"
179
+ )
180
+
181
+ @field_validator('timestamp')
182
+ @classmethod
183
+ def validate_timestamp(cls, v: str) -> str:
184
+ """Validate ISO timestamp format."""
185
+ from datetime import datetime
186
+ try:
187
+ datetime.fromisoformat(v.replace('Z', '+00:00'))
188
+ return v
189
+ except ValueError:
190
+ raise ValueError("timestamp must be valid ISO format")
191
+
192
+
193
+ class LogEntryMessage(WebSocketMessage):
194
+ """Log entry message (Driver → Server)."""
195
+
196
+ model_config = ConfigDict(
197
+ validate_assignment=True,
198
+ extra="forbid"
199
+ )
200
+
201
+ type: MessageType = Field(
202
+ default=MessageType.LOG_MESSAGE,
203
+ frozen=True
204
+ )
205
+
206
+ data: LogEntryData = Field(
207
+ description="Log entry data"
208
+ )
209
+
210
+
211
+ class LogBatchData(UnrealOnBaseModel):
212
+ """Log batch data payload - strictly typed."""
213
+
214
+ model_config = ConfigDict(
215
+ validate_assignment=True,
216
+ extra="forbid"
217
+ )
218
+
219
+ logs: List[LogEntryData] = Field(
220
+ min_length=1,
221
+ max_length=100,
222
+ description="Batch of log entries"
223
+ )
224
+
225
+ driver_id: str = Field(
226
+ min_length=1,
227
+ description="Driver ID for the batch"
228
+ )
229
+
230
+ batch_timestamp: str = Field(
231
+ description="Timestamp when batch was created (ISO format)"
232
+ )
233
+
234
+ @field_validator('batch_timestamp')
235
+ @classmethod
236
+ def validate_timestamp(cls, v: str) -> str:
237
+ """Validate ISO timestamp format."""
238
+ from datetime import datetime
239
+ try:
240
+ datetime.fromisoformat(v.replace('Z', '+00:00'))
241
+ return v
242
+ except ValueError:
243
+ raise ValueError("batch_timestamp must be valid ISO format")
244
+
245
+
246
+ class LogBatchMessage(WebSocketMessage):
247
+ """Log batch message (Driver → Server)."""
248
+
249
+ model_config = ConfigDict(
250
+ validate_assignment=True,
251
+ extra="forbid"
252
+ )
253
+
254
+ type: MessageType = Field(
255
+ default=MessageType.LOG_BATCH,
256
+ frozen=True
257
+ )
258
+
259
+ data: LogBatchData = Field(
260
+ description="Log batch data"
261
+ )