unrealon 1.0.9__py3-none-any.whl → 1.1.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 (302) hide show
  1. unrealon/__init__.py +23 -21
  2. unrealon-1.1.0.dist-info/METADATA +164 -0
  3. unrealon-1.1.0.dist-info/RECORD +82 -0
  4. {unrealon-1.0.9.dist-info → unrealon-1.1.0.dist-info}/WHEEL +1 -1
  5. unrealon-1.1.0.dist-info/entry_points.txt +9 -0
  6. {unrealon-1.0.9.dist-info → unrealon-1.1.0.dist-info/licenses}/LICENSE +1 -1
  7. unrealon_bridge/__init__.py +114 -0
  8. unrealon_bridge/cli.py +316 -0
  9. unrealon_bridge/client/__init__.py +93 -0
  10. unrealon_bridge/client/base.py +78 -0
  11. unrealon_bridge/client/commands.py +89 -0
  12. unrealon_bridge/client/connection.py +90 -0
  13. unrealon_bridge/client/events.py +65 -0
  14. unrealon_bridge/client/health.py +38 -0
  15. unrealon_bridge/client/html_parser.py +146 -0
  16. unrealon_bridge/client/logging.py +139 -0
  17. unrealon_bridge/client/proxy.py +70 -0
  18. unrealon_bridge/client/scheduler.py +450 -0
  19. unrealon_bridge/client/session.py +70 -0
  20. unrealon_bridge/configs/__init__.py +14 -0
  21. unrealon_bridge/configs/bridge_config.py +212 -0
  22. unrealon_bridge/configs/bridge_config.yaml +39 -0
  23. unrealon_bridge/models/__init__.py +138 -0
  24. unrealon_bridge/models/base.py +28 -0
  25. unrealon_bridge/models/command.py +41 -0
  26. unrealon_bridge/models/events.py +40 -0
  27. unrealon_bridge/models/html_parser.py +79 -0
  28. unrealon_bridge/models/logging.py +55 -0
  29. unrealon_bridge/models/parser.py +63 -0
  30. unrealon_bridge/models/proxy.py +41 -0
  31. unrealon_bridge/models/requests.py +95 -0
  32. unrealon_bridge/models/responses.py +88 -0
  33. unrealon_bridge/models/scheduler.py +592 -0
  34. unrealon_bridge/models/session.py +28 -0
  35. unrealon_bridge/server/__init__.py +91 -0
  36. unrealon_bridge/server/base.py +171 -0
  37. unrealon_bridge/server/handlers/__init__.py +23 -0
  38. unrealon_bridge/server/handlers/command.py +110 -0
  39. unrealon_bridge/server/handlers/html_parser.py +139 -0
  40. unrealon_bridge/server/handlers/logging.py +95 -0
  41. unrealon_bridge/server/handlers/parser.py +95 -0
  42. unrealon_bridge/server/handlers/proxy.py +75 -0
  43. unrealon_bridge/server/handlers/scheduler.py +545 -0
  44. unrealon_bridge/server/handlers/session.py +66 -0
  45. unrealon_browser/__init__.py +61 -18
  46. unrealon_browser/{src/cli → cli}/browser_cli.py +6 -13
  47. unrealon_browser/{src/cli → cli}/cookies_cli.py +5 -1
  48. unrealon_browser/{src/core → core}/browser_manager.py +2 -2
  49. unrealon_browser/{src/managers → managers}/captcha.py +1 -1
  50. unrealon_browser/{src/managers → managers}/cookies.py +1 -1
  51. unrealon_browser/managers/logger_bridge.py +231 -0
  52. unrealon_browser/{src/managers → managers}/profile.py +1 -1
  53. unrealon_driver/__init__.py +73 -19
  54. unrealon_driver/browser/__init__.py +8 -0
  55. unrealon_driver/browser/config.py +74 -0
  56. unrealon_driver/browser/manager.py +416 -0
  57. unrealon_driver/exceptions.py +28 -0
  58. unrealon_driver/parser/__init__.py +55 -0
  59. unrealon_driver/parser/cli_manager.py +141 -0
  60. unrealon_driver/parser/daemon_manager.py +227 -0
  61. unrealon_driver/parser/managers/__init__.py +46 -0
  62. unrealon_driver/parser/managers/browser.py +51 -0
  63. unrealon_driver/parser/managers/config.py +281 -0
  64. unrealon_driver/parser/managers/error.py +412 -0
  65. unrealon_driver/parser/managers/html.py +732 -0
  66. unrealon_driver/parser/managers/logging.py +609 -0
  67. unrealon_driver/parser/managers/result.py +321 -0
  68. unrealon_driver/parser/parser_manager.py +628 -0
  69. unrealon/sdk_config.py +0 -88
  70. unrealon-1.0.9.dist-info/METADATA +0 -810
  71. unrealon-1.0.9.dist-info/RECORD +0 -246
  72. unrealon_browser/pyproject.toml +0 -182
  73. unrealon_browser/src/__init__.py +0 -62
  74. unrealon_browser/src/managers/logger_bridge.py +0 -395
  75. unrealon_driver/README.md +0 -204
  76. unrealon_driver/pyproject.toml +0 -187
  77. unrealon_driver/src/__init__.py +0 -90
  78. unrealon_driver/src/cli/__init__.py +0 -10
  79. unrealon_driver/src/cli/main.py +0 -66
  80. unrealon_driver/src/cli/simple.py +0 -510
  81. unrealon_driver/src/config/__init__.py +0 -11
  82. unrealon_driver/src/config/auto_config.py +0 -478
  83. unrealon_driver/src/core/__init__.py +0 -18
  84. unrealon_driver/src/core/exceptions.py +0 -289
  85. unrealon_driver/src/core/parser.py +0 -638
  86. unrealon_driver/src/dto/__init__.py +0 -66
  87. unrealon_driver/src/dto/cli.py +0 -119
  88. unrealon_driver/src/dto/config.py +0 -18
  89. unrealon_driver/src/dto/events.py +0 -237
  90. unrealon_driver/src/dto/execution.py +0 -313
  91. unrealon_driver/src/dto/services.py +0 -311
  92. unrealon_driver/src/execution/__init__.py +0 -23
  93. unrealon_driver/src/execution/daemon_mode.py +0 -317
  94. unrealon_driver/src/execution/interactive_mode.py +0 -88
  95. unrealon_driver/src/execution/modes.py +0 -45
  96. unrealon_driver/src/execution/scheduled_mode.py +0 -209
  97. unrealon_driver/src/execution/test_mode.py +0 -250
  98. unrealon_driver/src/logging/__init__.py +0 -24
  99. unrealon_driver/src/logging/driver_logger.py +0 -512
  100. unrealon_driver/src/services/__init__.py +0 -24
  101. unrealon_driver/src/services/browser_service.py +0 -726
  102. unrealon_driver/src/services/llm/__init__.py +0 -15
  103. unrealon_driver/src/services/llm/browser_llm_service.py +0 -363
  104. unrealon_driver/src/services/llm/llm.py +0 -195
  105. unrealon_driver/src/services/logger_service.py +0 -232
  106. unrealon_driver/src/services/metrics_service.py +0 -185
  107. unrealon_driver/src/services/scheduler_service.py +0 -489
  108. unrealon_driver/src/services/websocket_service.py +0 -362
  109. unrealon_driver/src/utils/__init__.py +0 -16
  110. unrealon_driver/src/utils/service_factory.py +0 -317
  111. unrealon_driver/src/utils/time_formatter.py +0 -338
  112. unrealon_llm/README.md +0 -44
  113. unrealon_llm/__init__.py +0 -26
  114. unrealon_llm/pyproject.toml +0 -154
  115. unrealon_llm/src/__init__.py +0 -228
  116. unrealon_llm/src/cli/__init__.py +0 -0
  117. unrealon_llm/src/core/__init__.py +0 -11
  118. unrealon_llm/src/core/smart_client.py +0 -438
  119. unrealon_llm/src/dto/__init__.py +0 -155
  120. unrealon_llm/src/dto/models/__init__.py +0 -0
  121. unrealon_llm/src/dto/models/config.py +0 -343
  122. unrealon_llm/src/dto/models/core.py +0 -328
  123. unrealon_llm/src/dto/models/enums.py +0 -123
  124. unrealon_llm/src/dto/models/html_analysis.py +0 -345
  125. unrealon_llm/src/dto/models/statistics.py +0 -473
  126. unrealon_llm/src/dto/models/translation.py +0 -383
  127. unrealon_llm/src/dto/models/type_conversion.py +0 -462
  128. unrealon_llm/src/dto/schemas/__init__.py +0 -0
  129. unrealon_llm/src/exceptions.py +0 -392
  130. unrealon_llm/src/llm_config/__init__.py +0 -20
  131. unrealon_llm/src/llm_config/logging_config.py +0 -178
  132. unrealon_llm/src/llm_logging/__init__.py +0 -42
  133. unrealon_llm/src/llm_logging/llm_events.py +0 -107
  134. unrealon_llm/src/llm_logging/llm_logger.py +0 -466
  135. unrealon_llm/src/managers/__init__.py +0 -15
  136. unrealon_llm/src/managers/cache_manager.py +0 -67
  137. unrealon_llm/src/managers/cost_manager.py +0 -107
  138. unrealon_llm/src/managers/request_manager.py +0 -298
  139. unrealon_llm/src/modules/__init__.py +0 -0
  140. unrealon_llm/src/modules/html_processor/__init__.py +0 -25
  141. unrealon_llm/src/modules/html_processor/base_processor.py +0 -415
  142. unrealon_llm/src/modules/html_processor/details_processor.py +0 -85
  143. unrealon_llm/src/modules/html_processor/listing_processor.py +0 -91
  144. unrealon_llm/src/modules/html_processor/models/__init__.py +0 -20
  145. unrealon_llm/src/modules/html_processor/models/processing_models.py +0 -40
  146. unrealon_llm/src/modules/html_processor/models/universal_model.py +0 -56
  147. unrealon_llm/src/modules/html_processor/processor.py +0 -102
  148. unrealon_llm/src/modules/llm/__init__.py +0 -0
  149. unrealon_llm/src/modules/translator/__init__.py +0 -0
  150. unrealon_llm/src/provider.py +0 -116
  151. unrealon_llm/src/utils/__init__.py +0 -95
  152. unrealon_llm/src/utils/common.py +0 -64
  153. unrealon_llm/src/utils/data_extractor.py +0 -188
  154. unrealon_llm/src/utils/html_cleaner.py +0 -767
  155. unrealon_llm/src/utils/language_detector.py +0 -308
  156. unrealon_llm/src/utils/models_cache.py +0 -592
  157. unrealon_llm/src/utils/smart_counter.py +0 -229
  158. unrealon_llm/src/utils/token_counter.py +0 -189
  159. unrealon_sdk/README.md +0 -25
  160. unrealon_sdk/__init__.py +0 -30
  161. unrealon_sdk/pyproject.toml +0 -231
  162. unrealon_sdk/src/__init__.py +0 -150
  163. unrealon_sdk/src/cli/__init__.py +0 -12
  164. unrealon_sdk/src/cli/commands/__init__.py +0 -22
  165. unrealon_sdk/src/cli/commands/benchmark.py +0 -42
  166. unrealon_sdk/src/cli/commands/diagnostics.py +0 -573
  167. unrealon_sdk/src/cli/commands/health.py +0 -46
  168. unrealon_sdk/src/cli/commands/integration.py +0 -498
  169. unrealon_sdk/src/cli/commands/reports.py +0 -43
  170. unrealon_sdk/src/cli/commands/security.py +0 -36
  171. unrealon_sdk/src/cli/commands/server.py +0 -483
  172. unrealon_sdk/src/cli/commands/servers.py +0 -56
  173. unrealon_sdk/src/cli/commands/tests.py +0 -55
  174. unrealon_sdk/src/cli/main.py +0 -126
  175. unrealon_sdk/src/cli/utils/reporter.py +0 -519
  176. unrealon_sdk/src/clients/openapi.yaml +0 -3347
  177. unrealon_sdk/src/clients/python_http/__init__.py +0 -3
  178. unrealon_sdk/src/clients/python_http/api_config.py +0 -228
  179. unrealon_sdk/src/clients/python_http/models/BaseModel.py +0 -12
  180. unrealon_sdk/src/clients/python_http/models/BroadcastDeliveryStats.py +0 -33
  181. unrealon_sdk/src/clients/python_http/models/BroadcastMessage.py +0 -17
  182. unrealon_sdk/src/clients/python_http/models/BroadcastMessageRequest.py +0 -35
  183. unrealon_sdk/src/clients/python_http/models/BroadcastPriority.py +0 -10
  184. unrealon_sdk/src/clients/python_http/models/BroadcastResponse.py +0 -21
  185. unrealon_sdk/src/clients/python_http/models/BroadcastResultResponse.py +0 -33
  186. unrealon_sdk/src/clients/python_http/models/BroadcastTarget.py +0 -11
  187. unrealon_sdk/src/clients/python_http/models/ConnectionStats.py +0 -27
  188. unrealon_sdk/src/clients/python_http/models/ConnectionsResponse.py +0 -21
  189. unrealon_sdk/src/clients/python_http/models/DeveloperMessageResponse.py +0 -23
  190. unrealon_sdk/src/clients/python_http/models/ErrorResponse.py +0 -25
  191. unrealon_sdk/src/clients/python_http/models/HTTPValidationError.py +0 -16
  192. unrealon_sdk/src/clients/python_http/models/HealthResponse.py +0 -23
  193. unrealon_sdk/src/clients/python_http/models/HealthStatus.py +0 -33
  194. unrealon_sdk/src/clients/python_http/models/LogLevel.py +0 -10
  195. unrealon_sdk/src/clients/python_http/models/LoggingRequest.py +0 -27
  196. unrealon_sdk/src/clients/python_http/models/LoggingResponse.py +0 -23
  197. unrealon_sdk/src/clients/python_http/models/MaintenanceMode.py +0 -9
  198. unrealon_sdk/src/clients/python_http/models/MaintenanceModeRequest.py +0 -33
  199. unrealon_sdk/src/clients/python_http/models/MaintenanceStatusResponse.py +0 -39
  200. unrealon_sdk/src/clients/python_http/models/ParserCommandRequest.py +0 -25
  201. unrealon_sdk/src/clients/python_http/models/ParserMessageResponse.py +0 -21
  202. unrealon_sdk/src/clients/python_http/models/ParserRegistrationRequest.py +0 -28
  203. unrealon_sdk/src/clients/python_http/models/ParserRegistrationResponse.py +0 -25
  204. unrealon_sdk/src/clients/python_http/models/ParserType.py +0 -10
  205. unrealon_sdk/src/clients/python_http/models/ProxyBlockRequest.py +0 -19
  206. unrealon_sdk/src/clients/python_http/models/ProxyEndpointResponse.py +0 -20
  207. unrealon_sdk/src/clients/python_http/models/ProxyListResponse.py +0 -19
  208. unrealon_sdk/src/clients/python_http/models/ProxyProvider.py +0 -10
  209. unrealon_sdk/src/clients/python_http/models/ProxyPurchaseRequest.py +0 -25
  210. unrealon_sdk/src/clients/python_http/models/ProxyResponse.py +0 -47
  211. unrealon_sdk/src/clients/python_http/models/ProxyRotationRequest.py +0 -23
  212. unrealon_sdk/src/clients/python_http/models/ProxyStatus.py +0 -10
  213. unrealon_sdk/src/clients/python_http/models/ProxyUsageRequest.py +0 -19
  214. unrealon_sdk/src/clients/python_http/models/ProxyUsageStatsResponse.py +0 -26
  215. unrealon_sdk/src/clients/python_http/models/ServiceRegistrationDto.py +0 -23
  216. unrealon_sdk/src/clients/python_http/models/ServiceStatsResponse.py +0 -31
  217. unrealon_sdk/src/clients/python_http/models/SessionStartRequest.py +0 -23
  218. unrealon_sdk/src/clients/python_http/models/SuccessResponse.py +0 -25
  219. unrealon_sdk/src/clients/python_http/models/SystemNotificationResponse.py +0 -23
  220. unrealon_sdk/src/clients/python_http/models/ValidationError.py +0 -18
  221. unrealon_sdk/src/clients/python_http/models/ValidationErrorResponse.py +0 -21
  222. unrealon_sdk/src/clients/python_http/models/WebSocketMetrics.py +0 -21
  223. unrealon_sdk/src/clients/python_http/models/__init__.py +0 -44
  224. unrealon_sdk/src/clients/python_http/services/None_service.py +0 -35
  225. unrealon_sdk/src/clients/python_http/services/ParserManagement_service.py +0 -190
  226. unrealon_sdk/src/clients/python_http/services/ProxyManagement_service.py +0 -289
  227. unrealon_sdk/src/clients/python_http/services/SocketLogging_service.py +0 -187
  228. unrealon_sdk/src/clients/python_http/services/SystemHealth_service.py +0 -119
  229. unrealon_sdk/src/clients/python_http/services/WebSocketAPI_service.py +0 -198
  230. unrealon_sdk/src/clients/python_http/services/__init__.py +0 -0
  231. unrealon_sdk/src/clients/python_http/services/admin_service.py +0 -125
  232. unrealon_sdk/src/clients/python_http/services/async_None_service.py +0 -35
  233. unrealon_sdk/src/clients/python_http/services/async_ParserManagement_service.py +0 -190
  234. unrealon_sdk/src/clients/python_http/services/async_ProxyManagement_service.py +0 -289
  235. unrealon_sdk/src/clients/python_http/services/async_SocketLogging_service.py +0 -189
  236. unrealon_sdk/src/clients/python_http/services/async_SystemHealth_service.py +0 -123
  237. unrealon_sdk/src/clients/python_http/services/async_WebSocketAPI_service.py +0 -200
  238. unrealon_sdk/src/clients/python_http/services/async_admin_service.py +0 -125
  239. unrealon_sdk/src/clients/python_websocket/__init__.py +0 -28
  240. unrealon_sdk/src/clients/python_websocket/client.py +0 -490
  241. unrealon_sdk/src/clients/python_websocket/events.py +0 -732
  242. unrealon_sdk/src/clients/python_websocket/example.py +0 -136
  243. unrealon_sdk/src/clients/python_websocket/types.py +0 -871
  244. unrealon_sdk/src/core/__init__.py +0 -64
  245. unrealon_sdk/src/core/client.py +0 -556
  246. unrealon_sdk/src/core/config.py +0 -465
  247. unrealon_sdk/src/core/exceptions.py +0 -239
  248. unrealon_sdk/src/core/metadata.py +0 -191
  249. unrealon_sdk/src/core/models.py +0 -142
  250. unrealon_sdk/src/core/types.py +0 -68
  251. unrealon_sdk/src/dto/__init__.py +0 -268
  252. unrealon_sdk/src/dto/authentication.py +0 -108
  253. unrealon_sdk/src/dto/cache.py +0 -208
  254. unrealon_sdk/src/dto/common.py +0 -19
  255. unrealon_sdk/src/dto/concurrency.py +0 -393
  256. unrealon_sdk/src/dto/events.py +0 -108
  257. unrealon_sdk/src/dto/health.py +0 -339
  258. unrealon_sdk/src/dto/load_balancing.py +0 -336
  259. unrealon_sdk/src/dto/logging.py +0 -230
  260. unrealon_sdk/src/dto/performance.py +0 -165
  261. unrealon_sdk/src/dto/rate_limiting.py +0 -295
  262. unrealon_sdk/src/dto/resource_pooling.py +0 -128
  263. unrealon_sdk/src/dto/structured_logging.py +0 -112
  264. unrealon_sdk/src/dto/task_scheduling.py +0 -121
  265. unrealon_sdk/src/dto/websocket.py +0 -55
  266. unrealon_sdk/src/enterprise/__init__.py +0 -59
  267. unrealon_sdk/src/enterprise/authentication.py +0 -401
  268. unrealon_sdk/src/enterprise/cache_manager.py +0 -578
  269. unrealon_sdk/src/enterprise/error_recovery.py +0 -494
  270. unrealon_sdk/src/enterprise/event_system.py +0 -549
  271. unrealon_sdk/src/enterprise/health_monitor.py +0 -747
  272. unrealon_sdk/src/enterprise/load_balancer.py +0 -964
  273. unrealon_sdk/src/enterprise/logging/__init__.py +0 -68
  274. unrealon_sdk/src/enterprise/logging/cleanup.py +0 -156
  275. unrealon_sdk/src/enterprise/logging/development.py +0 -744
  276. unrealon_sdk/src/enterprise/logging/service.py +0 -410
  277. unrealon_sdk/src/enterprise/multithreading_manager.py +0 -853
  278. unrealon_sdk/src/enterprise/performance_monitor.py +0 -539
  279. unrealon_sdk/src/enterprise/proxy_manager.py +0 -696
  280. unrealon_sdk/src/enterprise/rate_limiter.py +0 -652
  281. unrealon_sdk/src/enterprise/resource_pool.py +0 -763
  282. unrealon_sdk/src/enterprise/task_scheduler.py +0 -709
  283. unrealon_sdk/src/internal/__init__.py +0 -10
  284. unrealon_sdk/src/internal/command_router.py +0 -497
  285. unrealon_sdk/src/internal/connection_manager.py +0 -397
  286. unrealon_sdk/src/internal/http_client.py +0 -446
  287. unrealon_sdk/src/internal/websocket_client.py +0 -420
  288. unrealon_sdk/src/provider.py +0 -471
  289. unrealon_sdk/src/utils.py +0 -234
  290. /unrealon_browser/{src/cli → cli}/__init__.py +0 -0
  291. /unrealon_browser/{src/cli → cli}/interactive_mode.py +0 -0
  292. /unrealon_browser/{src/cli → cli}/main.py +0 -0
  293. /unrealon_browser/{src/core → core}/__init__.py +0 -0
  294. /unrealon_browser/{src/dto → dto}/__init__.py +0 -0
  295. /unrealon_browser/{src/dto → dto}/models/config.py +0 -0
  296. /unrealon_browser/{src/dto → dto}/models/core.py +0 -0
  297. /unrealon_browser/{src/dto → dto}/models/dataclasses.py +0 -0
  298. /unrealon_browser/{src/dto → dto}/models/detection.py +0 -0
  299. /unrealon_browser/{src/dto → dto}/models/enums.py +0 -0
  300. /unrealon_browser/{src/dto → dto}/models/statistics.py +0 -0
  301. /unrealon_browser/{src/managers → managers}/__init__.py +0 -0
  302. /unrealon_browser/{src/managers → managers}/stealth.py +0 -0
@@ -1,471 +0,0 @@
1
- """
2
- 🚀 UnrealOn SDK Driver - One-Stop Import for Parser Development
3
-
4
- This module provides all necessary imports for developing parsers with the UnrealOn SDK.
5
- Ensures Pydantic v2 compliance and follows REQUIREMENTS_COMPLETE.md standards.
6
-
7
- Usage:
8
- from unrealon_sdk.src.provider import *
9
-
10
- # Or use specific groups:
11
- from unrealon_sdk.src.provider import Core, Enterprise, Models, Browser, Utils
12
-
13
- # Quick setup with global API configuration:
14
- Utils.set_global_api_key("your_api_key_here")
15
- config = Utils.create_parser_config("my_parser")
16
- client = Core.AdapterClient(config)
17
- """
18
-
19
- from typing import Dict, List, Optional, Any, Union
20
- from datetime import datetime, timezone
21
- from enum import Enum
22
-
23
- # =============================================================================
24
- # Core SDK Components
25
- # =============================================================================
26
-
27
- # Core client and configuration
28
- from unrealon_sdk.src.core.client import AdapterClient
29
- from unrealon_sdk.src.core.config import AdapterConfig
30
- from unrealon_sdk.src.core.exceptions import UnrealOnError, ConnectionError
31
-
32
- # =============================================================================
33
- # Enterprise Components
34
- # =============================================================================
35
-
36
- # Enterprise services
37
- from unrealon_sdk.src.enterprise.proxy_manager import ProxyManager
38
- from unrealon_sdk.src.enterprise.logging import LoggingService, get_logger
39
- from unrealon_sdk.src.enterprise.performance_monitor import PerformanceMonitor
40
- from unrealon_sdk.src.enterprise.health_monitor import HealthMonitor
41
- from unrealon_sdk.src.enterprise.cache_manager import CacheManager
42
- from unrealon_sdk.src.enterprise.rate_limiter import RateLimiter
43
- from unrealon_sdk.src.enterprise.multithreading_manager import MultithreadingManager
44
- from unrealon_sdk.src.enterprise.task_scheduler import TaskScheduler
45
-
46
- # =============================================================================
47
- # SDK Auto-Generated Models (Pydantic v2 Compliant)
48
- # =============================================================================
49
-
50
- # WebSocket types and events
51
- from unrealon_sdk.src.clients.python_websocket.types import (
52
- # Enums
53
- ParserStatus,
54
- CommandType,
55
- CommandStatus,
56
- CommandPriority,
57
- ParserType,
58
- ProcessingPhase,
59
- ServiceStatus,
60
- ServiceType,
61
- ProxyProvider,
62
- ProxyStatus,
63
- ProxyProtocol,
64
- ProxyRotationStrategy,
65
- # Event Models
66
- ParserCommandEvent,
67
- ParserStatusEvent,
68
- ParserRegisteredEvent,
69
- ConnectionEvent,
70
- PongEvent,
71
- ErrorEvent,
72
- NotificationEvent,
73
- SystemEvent,
74
- # Message Models
75
- LogEntryMessage,
76
- CommandMessage,
77
- CommandCompletionMessage,
78
- AdminBroadcastMessage,
79
- MaintenanceNotificationMessage,
80
- # Connection Models
81
- ConnectionInfo,
82
- ConnectionStats,
83
- HealthStatus,
84
- WebSocketMetrics,
85
- # Response Models
86
- BroadcastResponse,
87
- ParserMessageResponse,
88
- DeveloperMessageResponse,
89
- ConnectionsResponse,
90
- SystemNotificationResponse,
91
- # Proxy Models
92
- Proxy,
93
- ProxyEndpoint,
94
- ProxyCredentials,
95
- ProxyUsageStats,
96
- ProxyAllocation,
97
- ProxySummary,
98
- ProxyDetails,
99
- ProxyStatistics,
100
- # Health Models
101
- ComponentHealth,
102
- SystemMetrics,
103
- SystemHealthReport,
104
- HealthStatsResponse,
105
- BroadcastDeliveryStats,
106
- # Metrics Models
107
- SystemMetricsPoint,
108
- SystemMetricsResponse,
109
- SystemMetricsWebSocketEvent,
110
- UserStatistics,
111
- SystemStatistics,
112
- RealTimeMetrics,
113
- )
114
-
115
- # HTTP models
116
- from unrealon_sdk.src.clients.python_http.models import (
117
- SuccessResponse,
118
- ErrorResponse,
119
- ValidationErrorResponse,
120
- ParserRegistrationRequest,
121
- ParserRegistrationResponse,
122
- ParserCommandRequest,
123
- HealthResponse,
124
- LogLevel,
125
- )
126
-
127
- # Global API configuration
128
- from unrealon_sdk.src.clients.python_http.api_config import (
129
- configure_global_api,
130
- set_global_api_key,
131
- set_global_base_url,
132
- get_global_config,
133
- )
134
-
135
- # =============================================================================
136
- # Simple Aliases for Commonly Used Models
137
- # =============================================================================
138
-
139
- # Use the existing SDK models - no need for complex docs imports
140
- DocParserCommand = ParserCommandEvent
141
- DocParserResponse = SuccessResponse
142
- DocParserStatus = ParserStatus
143
- DocCommandType = CommandType
144
-
145
- # =============================================================================
146
- # Browser Integration (UnrealOn Browser - Always Available)
147
- # =============================================================================
148
-
149
- from unrealon_browser.src import (
150
- BrowserManager,
151
- BrowserConfig,
152
- BrowserType,
153
- BrowserMode,
154
- CookieManager,
155
- StealthManager,
156
- CaptchaDetector,
157
- CaptchaDetectionResult,
158
- CaptchaType,
159
- CaptchaStatus,
160
- BrowserSession,
161
- ProxyInfo,
162
- )
163
-
164
- # =============================================================================
165
- # Helper Functions for Parser Development
166
- # =============================================================================
167
-
168
-
169
- def create_parser_config(
170
- parser_id: str,
171
- parser_name: str = None,
172
- api_key: str = None,
173
- server_url: str = "ws://localhost:8000",
174
- environment: str = "development",
175
- ) -> AdapterConfig:
176
- """
177
- Create a properly configured AdapterConfig for parser development.
178
-
179
- Args:
180
- parser_id: Unique parser identifier
181
- parser_name: Human-readable parser name (defaults to parser_id)
182
- api_key: UnrealOn API key (falls back to global config if not provided)
183
- server_url: WebSocket server URL
184
- environment: Environment name (development/production)
185
-
186
- Returns:
187
- Configured AdapterConfig instance
188
-
189
- Example:
190
- # With global API key set
191
- Utils.set_global_api_key("up_dev_test_integration_001")
192
- config = create_parser_config("amazon_scraper")
193
-
194
- # Or with explicit API key
195
- config = create_parser_config("amazon_scraper", api_key="up_dev_test_integration_001")
196
- """
197
- # Use provided api_key or fall back to global configuration
198
- if api_key is None:
199
- global_config = get_global_config()
200
- api_key = global_config.get_access_token()
201
- if api_key is None:
202
- api_key = "up_dev_test_integration_001" # Default fallback
203
-
204
- return AdapterConfig(
205
- api_key=api_key,
206
- parser_id=parser_id,
207
- parser_name=parser_name or parser_id,
208
- server_url=server_url,
209
- environment=environment,
210
- enable_ssl=server_url.startswith("wss://"),
211
- connection_timeout=30,
212
- reconnect_attempts=5,
213
- heartbeat_interval=30,
214
- # Enable enterprise features
215
- enable_proxy_rotation=True,
216
- enable_monitoring=True,
217
- enable_logging=True,
218
- )
219
-
220
-
221
- def create_browser_config(
222
- parser_name: str,
223
- browser_type: BrowserType = None,
224
- # 🔥 stealth_level removed - STEALTH ALWAYS ON!
225
- headless: bool = True,
226
- ) -> BrowserConfig:
227
- """
228
- Create a browser configuration for parsing with stealth features.
229
- 🔥 STEALTH ALWAYS ON - NO CONFIG NEEDED!
230
-
231
- Args:
232
- parser_name: Parser identifier for browser sessions
233
- browser_type: Browser type (chromium, firefox, webkit)
234
- headless: Run in headless mode
235
-
236
- Returns:
237
- Configured BrowserConfig instance with STEALTH ALWAYS ON
238
- """
239
- return BrowserConfig(
240
- parser_name=parser_name,
241
- browser_type=browser_type or BrowserType.CHROMIUM,
242
- mode=BrowserMode.HEADLESS if headless else BrowserMode.HEADED,
243
- # 🔥 STEALTH ALWAYS ON - NO CONFIG NEEDED!
244
- )
245
-
246
-
247
- def create_success_response(
248
- command_id: str, message: str, data: Optional[Dict[str, Any]] = None
249
- ) -> SuccessResponse:
250
- """
251
- Create a properly typed success response.
252
-
253
- Args:
254
- command_id: Original command identifier
255
- message: Success message
256
- data: Response data (optional)
257
-
258
- Returns:
259
- SuccessResponse instance
260
- """
261
- return SuccessResponse(
262
- success=True, message=message, data=data, timestamp=datetime.now(timezone.utc).isoformat()
263
- )
264
-
265
-
266
- def create_error_response(
267
- message: str, error_code: Optional[str] = None, details: Optional[Dict[str, Any]] = None
268
- ) -> ErrorResponse:
269
- """
270
- Create a properly typed error response.
271
-
272
- Args:
273
- message: Error message
274
- error_code: Error code for programmatic handling
275
- details: Additional error details
276
-
277
- Returns:
278
- ErrorResponse instance
279
- """
280
- return ErrorResponse(
281
- success=False,
282
- message=message,
283
- error_code=error_code,
284
- details=details or {},
285
- timestamp=datetime.now(timezone.utc).isoformat(),
286
- )
287
-
288
-
289
- def get_system_metrics() -> Dict[str, Any]:
290
- """
291
- Get current system metrics for health monitoring.
292
-
293
- Returns:
294
- Dictionary with system metrics
295
- """
296
- try:
297
- import psutil
298
-
299
- process = psutil.Process()
300
-
301
- return {
302
- "memory_mb": round(process.memory_info().rss / 1024 / 1024, 2),
303
- "cpu_percent": round(process.cpu_percent(), 2),
304
- "connections": len(process.connections()),
305
- "threads": process.num_threads(),
306
- "uptime_seconds": int(
307
- (datetime.now() - datetime.fromtimestamp(process.create_time())).total_seconds()
308
- ),
309
- }
310
- except ImportError:
311
- return {
312
- "memory_mb": 0.0,
313
- "cpu_percent": 0.0,
314
- "connections": 0,
315
- "threads": 1,
316
- "uptime_seconds": 0,
317
- }
318
-
319
-
320
- # =============================================================================
321
- # Grouped Imports for Easy Access
322
- # =============================================================================
323
-
324
-
325
- class Core:
326
- """Core SDK components."""
327
-
328
- AdapterClient = AdapterClient
329
- AdapterConfig = AdapterConfig
330
- UnrealOnError = UnrealOnError
331
- ConnectionError = ConnectionError
332
-
333
-
334
- class Enterprise:
335
- """Enterprise services and managers."""
336
-
337
- ProxyManager = ProxyManager
338
- LoggingService = LoggingService
339
- PerformanceMonitor = PerformanceMonitor
340
- HealthMonitor = HealthMonitor
341
- CacheManager = CacheManager
342
- RateLimiter = RateLimiter
343
- MultithreadingManager = MultithreadingManager
344
- TaskScheduler = TaskScheduler
345
-
346
-
347
- class Models:
348
- """All Pydantic models for events, commands, responses."""
349
-
350
- # Status and Commands
351
- ParserStatus = ParserStatus
352
- CommandType = CommandType
353
- CommandStatus = CommandStatus
354
- CommandPriority = CommandPriority
355
-
356
- # Events
357
- ParserCommandEvent = ParserCommandEvent
358
- ParserStatusEvent = ParserStatusEvent
359
- ParserRegisteredEvent = ParserRegisteredEvent
360
- ErrorEvent = ErrorEvent
361
-
362
- # Responses
363
- SuccessResponse = SuccessResponse
364
- ErrorResponse = ErrorResponse
365
- HealthResponse = HealthResponse
366
-
367
- # Registration
368
- ParserRegistrationRequest = ParserRegistrationRequest
369
- ParserRegistrationResponse = ParserRegistrationResponse
370
-
371
- # Proxy
372
- Proxy = Proxy
373
- ProxyUsageStats = ProxyUsageStats
374
- ProxyStatistics = ProxyStatistics
375
-
376
- # Health & Metrics
377
- SystemHealthReport = SystemHealthReport
378
- RealTimeMetrics = RealTimeMetrics
379
- SystemMetrics = SystemMetrics
380
-
381
-
382
- class Browser:
383
- """Browser automation components."""
384
-
385
- BrowserManager = BrowserManager
386
- BrowserConfig = BrowserConfig
387
- BrowserType = BrowserType
388
- BrowserMode = BrowserMode
389
- # StealthLevel = StealthLevel 🔥 REMOVED - STEALTH ALWAYS ON!
390
- CookieManager = CookieManager
391
- StealthManager = StealthManager
392
- CaptchaDetector = CaptchaDetector
393
- CaptchaDetectionResult = CaptchaDetectionResult
394
- CaptchaType = CaptchaType
395
- CaptchaStatus = CaptchaStatus
396
- BrowserSession = BrowserSession
397
- ProxyInfo = ProxyInfo
398
-
399
-
400
- class Utils:
401
- """Utility functions for parser development."""
402
-
403
- create_parser_config = staticmethod(create_parser_config)
404
- create_browser_config = staticmethod(create_browser_config)
405
- create_success_response = staticmethod(create_success_response)
406
- create_error_response = staticmethod(create_error_response)
407
- get_system_metrics = staticmethod(get_system_metrics)
408
-
409
- # Global API configuration helpers
410
- set_global_api_key = staticmethod(set_global_api_key)
411
- set_global_base_url = staticmethod(set_global_base_url)
412
- configure_global_api = staticmethod(configure_global_api)
413
- get_global_api_config = staticmethod(get_global_config)
414
-
415
- # Logging helper
416
- get_logger = staticmethod(get_logger)
417
-
418
-
419
- # =============================================================================
420
- # Export All for Easy Import
421
- # =============================================================================
422
-
423
- __all__ = [
424
- # Groups
425
- "Core",
426
- "Enterprise",
427
- "Models",
428
- "Browser",
429
- "Utils",
430
- # Individual imports (for backward compatibility)
431
- "AdapterClient",
432
- "AdapterConfig",
433
- "UnrealOnError",
434
- "ConnectionError",
435
- "ProxyManager",
436
- "LoggingService",
437
- "PerformanceMonitor",
438
- "HealthMonitor",
439
- "ParserStatus",
440
- "CommandType",
441
- "ParserCommandEvent",
442
- "ParserStatusEvent",
443
- "SuccessResponse",
444
- "ErrorResponse",
445
- "HealthResponse",
446
- "ParserRegistrationRequest",
447
- "ParserRegistrationResponse",
448
- "create_parser_config",
449
- "create_browser_config",
450
- "create_success_response",
451
- "create_error_response",
452
- "get_system_metrics",
453
- ]
454
-
455
- # =============================================================================
456
- # Module Information
457
- # =============================================================================
458
-
459
- __version__ = "1.0.0"
460
- __author__ = "UnrealOn SDK Team"
461
- __description__ = "Unified driver for UnrealOn SDK parser development"
462
-
463
- # Print status when imported
464
- if __name__ != "__main__":
465
- import logging
466
-
467
- logger = logging.getLogger(__name__)
468
- logger.info(f"🚀 UnrealOn SDK Driver v{__version__} loaded")
469
- logger.info(f" 🌐 Browser integration: ✅ Available")
470
- logger.info(f" 📦 Total exports: {len(__all__)} classes/functions")
471
- logger.info(f" 📂 Groups: Core, Enterprise, Models, Browser, Utils")
unrealon_sdk/src/utils.py DELETED
@@ -1,234 +0,0 @@
1
- """
2
- Utility functions for UnrealOn SDK v1.0
3
-
4
- Provides common helper functions used throughout the SDK.
5
- """
6
-
7
- import re
8
- import uuid
9
- import time
10
- import platform
11
- import sys
12
- from typing import Dict, Any, Optional
13
- from urllib.parse import urlparse
14
-
15
- from unrealon_sdk.src.core.metadata import EnvironmentMetadata
16
-
17
-
18
- def validate_api_key(api_key: str) -> bool:
19
- """
20
- Validate API key format.
21
-
22
- Args:
23
- api_key: API key to validate
24
-
25
- Returns:
26
- bool: True if valid, False otherwise
27
- """
28
- if not api_key:
29
- return False
30
-
31
- # Check if it matches the expected pattern
32
- pattern = r"^up_(dev|prod)_[a-zA-Z0-9_]{16,}$"
33
- return bool(re.match(pattern, api_key))
34
-
35
-
36
- def extract_domain(url: str) -> Optional[str]:
37
- """
38
- Extract domain from URL.
39
-
40
- Args:
41
- url: URL to extract domain from
42
-
43
- Returns:
44
- str: Domain name or None if invalid URL
45
- """
46
- try:
47
- parsed = urlparse(url)
48
- return parsed.netloc
49
- except Exception:
50
- return None
51
-
52
-
53
- def calculate_success_rate(successful: int, total: int) -> float:
54
- """
55
- Calculate success rate percentage.
56
-
57
- Args:
58
- successful: Number of successful operations
59
- total: Total number of operations
60
-
61
- Returns:
62
- float: Success rate as percentage (0.0-100.0)
63
- """
64
- if total == 0:
65
- return 0.0
66
- return (successful / total) * 100.0
67
-
68
-
69
- def format_duration(milliseconds: float) -> str:
70
- """
71
- Format duration in milliseconds to human-readable string.
72
-
73
- Args:
74
- milliseconds: Duration in milliseconds
75
-
76
- Returns:
77
- str: Formatted duration string
78
- """
79
- if milliseconds < 1000:
80
- return f"{milliseconds:.2f}ms"
81
-
82
- seconds = milliseconds / 1000
83
- if seconds < 60:
84
- return f"{seconds:.2f}s"
85
-
86
- minutes = seconds / 60
87
- if minutes < 60:
88
- return f"{minutes:.1f}m"
89
-
90
- hours = minutes / 60
91
- return f"{hours:.1f}h"
92
-
93
-
94
- def generate_correlation_id() -> str:
95
- """
96
- Generate a unique correlation ID for request tracking.
97
-
98
- Returns:
99
- str: Unique correlation ID
100
- """
101
- return str(uuid.uuid4())
102
-
103
-
104
- def generate_session_id() -> str:
105
- """
106
- Generate a unique session ID.
107
-
108
- Returns:
109
- str: Unique session ID
110
- """
111
- timestamp = int(time.time() * 1000)
112
- unique_id = str(uuid.uuid4())[:8]
113
- return f"sess_{timestamp}_{unique_id}"
114
-
115
-
116
- def safe_get(data: Dict[str, Any], key: str, default: Any = None) -> Any:
117
- """
118
- Safely get value from dictionary with dot notation support.
119
-
120
- Args:
121
- data: Dictionary to get value from
122
- key: Key to get (supports dot notation like 'user.profile.name')
123
- default: Default value if key not found
124
-
125
- Returns:
126
- Any: Value at key or default
127
- """
128
- try:
129
- if "." not in key:
130
- return data.get(key, default)
131
-
132
- keys = key.split(".")
133
- value = data
134
- for k in keys:
135
- if isinstance(value, dict) and k in value:
136
- value = value[k]
137
- else:
138
- return default
139
- return value
140
- except Exception:
141
- return default
142
-
143
-
144
- def merge_configs(base: Dict[str, Any], override: Dict[str, Any]) -> Dict[str, Any]:
145
- """
146
- Merge two configuration dictionaries recursively.
147
-
148
- Args:
149
- base: Base configuration
150
- override: Configuration to merge on top
151
-
152
- Returns:
153
- Dict[str, Any]: Merged configuration
154
- """
155
- result = base.copy()
156
-
157
- for key, value in override.items():
158
- if key in result and isinstance(result[key], dict) and isinstance(value, dict):
159
- result[key] = merge_configs(result[key], value)
160
- else:
161
- result[key] = value
162
-
163
- return result
164
-
165
-
166
- def sanitize_log_data(data: Dict[str, Any]) -> Dict[str, Any]:
167
- """
168
- Sanitize log data by removing sensitive information.
169
-
170
- Args:
171
- data: Data to sanitize
172
-
173
- Returns:
174
- Dict[str, Any]: Sanitized data
175
- """
176
- sensitive_keys = {
177
- "password",
178
- "token",
179
- "api_key",
180
- "secret",
181
- "auth",
182
- "authorization",
183
- "credentials",
184
- "key",
185
- }
186
-
187
- sanitized = {}
188
- for key, value in data.items():
189
- if any(sensitive in key.lower() for sensitive in sensitive_keys):
190
- sanitized[key] = "***REDACTED***"
191
- elif isinstance(value, dict):
192
- sanitized[key] = sanitize_log_data(value)
193
- elif isinstance(value, list):
194
- sanitized[key] = [
195
- sanitize_log_data(item) if isinstance(item, dict) else item for item in value
196
- ]
197
- else:
198
- sanitized[key] = value
199
-
200
- return sanitized
201
-
202
-
203
- def is_url_valid(url: str) -> bool:
204
- """
205
- Check if URL is valid.
206
-
207
- Args:
208
- url: URL to validate
209
-
210
- Returns:
211
- bool: True if valid URL
212
- """
213
- try:
214
- result = urlparse(url)
215
- return all([result.scheme, result.netloc])
216
- except Exception:
217
- return False
218
-
219
-
220
- def get_client_info() -> EnvironmentMetadata:
221
- """
222
- Get client information for debugging/monitoring.
223
-
224
- Returns:
225
- EnvironmentMetadata: Structured client information
226
- """
227
- return EnvironmentMetadata(
228
- environment="runtime",
229
- python_version=f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}",
230
- platform=platform.platform(),
231
- architecture=platform.architecture()[0],
232
- sdk_version="1.0.0",
233
- correlation_id=generate_correlation_id(),
234
- )
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes