intuned-runtime 1.3.0rc0__py3-none-any.whl → 1.3.2__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 (45) hide show
  1. intuned_cli/__init__.py +15 -24
  2. intuned_cli/commands/__init__.py +6 -1
  3. intuned_cli/commands/attempt_api_command.py +8 -0
  4. intuned_cli/commands/attempt_authsession_check_command.py +8 -0
  5. intuned_cli/commands/attempt_authsession_command.py +4 -4
  6. intuned_cli/commands/attempt_authsession_create_command.py +9 -1
  7. intuned_cli/commands/attempt_command.py +4 -4
  8. intuned_cli/commands/authsession_command.py +12 -0
  9. intuned_cli/commands/authsession_record_command.py +54 -0
  10. intuned_cli/commands/command.py +6 -4
  11. intuned_cli/commands/deploy_command.py +2 -0
  12. intuned_cli/commands/init_command.py +2 -0
  13. intuned_cli/commands/run_api_command.py +9 -1
  14. intuned_cli/commands/run_authsession_command.py +4 -4
  15. intuned_cli/commands/run_authsession_create_command.py +34 -4
  16. intuned_cli/commands/run_authsession_update_command.py +33 -4
  17. intuned_cli/commands/run_authsession_validate_command.py +32 -3
  18. intuned_cli/commands/run_command.py +4 -4
  19. intuned_cli/commands/save_command.py +2 -0
  20. intuned_cli/controller/__test__/test_api.py +159 -18
  21. intuned_cli/controller/__test__/test_authsession.py +497 -6
  22. intuned_cli/controller/api.py +40 -39
  23. intuned_cli/controller/authsession.py +213 -110
  24. intuned_cli/controller/deploy.py +3 -3
  25. intuned_cli/controller/save.py +47 -48
  26. intuned_cli/types.py +14 -0
  27. intuned_cli/utils/__test__/test_browser.py +132 -0
  28. intuned_cli/utils/__test__/test_traces.py +27 -0
  29. intuned_cli/utils/api_helpers.py +54 -5
  30. intuned_cli/utils/auth_session_helpers.py +42 -7
  31. intuned_cli/utils/backend.py +4 -1
  32. intuned_cli/utils/browser.py +63 -0
  33. intuned_cli/utils/error.py +14 -0
  34. intuned_cli/utils/exclusions.py +1 -0
  35. intuned_cli/utils/help.py +9 -0
  36. intuned_cli/utils/traces.py +31 -0
  37. intuned_cli/utils/wrapper.py +58 -0
  38. intuned_internal_cli/__init__.py +7 -0
  39. {intuned_runtime-1.3.0rc0.dist-info → intuned_runtime-1.3.2.dist-info}/METADATA +4 -2
  40. {intuned_runtime-1.3.0rc0.dist-info → intuned_runtime-1.3.2.dist-info}/RECORD +45 -37
  41. runtime/browser/launch_chromium.py +19 -8
  42. runtime/types/settings_types.py +13 -4
  43. {intuned_runtime-1.3.0rc0.dist-info → intuned_runtime-1.3.2.dist-info}/WHEEL +0 -0
  44. {intuned_runtime-1.3.0rc0.dist-info → intuned_runtime-1.3.2.dist-info}/entry_points.txt +0 -0
  45. {intuned_runtime-1.3.0rc0.dist-info → intuned_runtime-1.3.2.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,58 @@
1
+ import asyncio
2
+ from collections.abc import Awaitable
3
+ from collections.abc import Callable
4
+ from functools import wraps
5
+ from typing import Any
6
+ from typing import cast
7
+
8
+ from intuned_cli.utils.browser import close_cli_browser
9
+ from intuned_cli.utils.browser import is_cli_browser_launched
10
+ from intuned_cli.utils.console import console
11
+ from intuned_cli.utils.error import CLIError
12
+ from intuned_cli.utils.error import CLIExit
13
+ from intuned_cli.utils.error import log_automation_error
14
+ from runtime.errors.run_api_errors import RunApiError
15
+
16
+
17
+ def cli_command[F: Callable[..., Awaitable[Any]]](fn: F) -> F:
18
+ @wraps(fn)
19
+ async def wrapper(*args: Any, **kwargs: Any):
20
+ keep_open = kwargs.get("keep_browser_open", False)
21
+ if keep_open:
22
+ console.print(
23
+ "[bold]--keep-browser-open is set, the CLI will not close the last browser after the command completes.[/bold]"
24
+ )
25
+ try:
26
+ result = await fn(*args, **kwargs)
27
+ return result
28
+ except CLIError as e:
29
+ if e.auto_color:
30
+ console.print(f"[bold red]{e.message}[/bold red]")
31
+ else:
32
+ console.print(e.message)
33
+ raise CLIExit(1) from e
34
+ except RunApiError as e:
35
+ log_automation_error(e)
36
+ raise CLIExit(1) from e
37
+ except KeyboardInterrupt:
38
+ console.print("[bold red]Aborted[/bold red]")
39
+ raise CLIExit(1) from None
40
+ except Exception as e:
41
+ console.print(
42
+ f"[red][bold]An error occurred: [/bold]{e}\n[bold]Please report this issue to the Intuned team.[/bold]"
43
+ )
44
+ raise CLIExit(1) from e
45
+ finally:
46
+ if keep_open:
47
+ await _wait_for_user_input()
48
+ await close_cli_browser()
49
+
50
+ return cast(F, wrapper)
51
+
52
+
53
+ async def _wait_for_user_input():
54
+ if not is_cli_browser_launched():
55
+ return
56
+ if not console.is_terminal:
57
+ return
58
+ await asyncio.to_thread(console.input, "Press Enter to continue...")
@@ -1,3 +1,4 @@
1
+ import logging
1
2
  import sys
2
3
  import traceback
3
4
 
@@ -12,6 +13,12 @@ from runtime.context.context import IntunedContext
12
13
 
13
14
  from . import commands
14
15
 
16
+ logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s")
17
+
18
+ logging.getLogger("runtime").setLevel(logging.INFO)
19
+ logging.getLogger("intuned_runtime").setLevel(logging.INFO)
20
+ logging.getLogger("intuned_browser").setLevel(logging.INFO)
21
+
15
22
 
16
23
  def run():
17
24
  dotenv = find_dotenv(usecwd=True)
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: intuned-runtime
3
- Version: 1.3.0rc0
4
- Summary: Runtime commands for Intuned platform Python scrapers
3
+ Version: 1.3.2
4
+ Summary: Runtime SDK that powers browser automation projects running on Intuned
5
5
  License: Elastic-2.0
6
6
  License-File: LICENSE
7
7
  Keywords: runtime,intuned
@@ -23,12 +23,14 @@ Requires-Dist: browserforge[all]
23
23
  Requires-Dist: camoufox[geoip] (>=0.4.11,<0.5.0)
24
24
  Requires-Dist: gitpython (>=3.1.43,<4.0.0)
25
25
  Requires-Dist: httpx (>=0.23.0,<1)
26
+ Requires-Dist: jsonc-parser (>=1.1.5,<2.0.0)
26
27
  Requires-Dist: more-termcolor (>=1.1.3,<2.0.0)
27
28
  Requires-Dist: pathspec (>=0.12.1,<0.13.0)
28
29
  Requires-Dist: pydantic (>=2.10.6,<3.0.0)
29
30
  Requires-Dist: pyright (>=1.1.387,<2.0.0)
30
31
  Requires-Dist: python-dotenv (==1.0.1)
31
32
  Requires-Dist: pytimeparse (>=1.1.8,<2.0.0)
33
+ Requires-Dist: pyyaml (>=6.0.3,<7.0.0)
32
34
  Requires-Dist: requests (>=2.32.3,<3.0.0)
33
35
  Requires-Dist: rich (>=14.1.0,<15.0.0)
34
36
  Requires-Dist: ruff (>=0.7.2,<0.8.0)
@@ -1,39 +1,47 @@
1
- intuned_cli/__init__.py,sha256=COYx7VKi1Qdsusc58Tt3P1DpGUd6LFomjbf53GTCVKI,1466
2
- intuned_cli/commands/__init__.py,sha256=pN4XuY6EAAaiJRoRcpcyKw4Lei9ZfS7zmoaoNuwbz9I,1291
3
- intuned_cli/commands/attempt_api_command.py,sha256=3iN3L_vd--wMb96zgW-qNfyaqrGTUdcxKhYgifQu9XU,1949
4
- intuned_cli/commands/attempt_authsession_check_command.py,sha256=y7ODZLLSF5Pzm3LHOdRr7frGeuFn18NKHNtkg6_NH9Q,1329
5
- intuned_cli/commands/attempt_authsession_command.py,sha256=hir9y1XyW9VYioOWT6C1-dH43f3JcHhIlfEEijMg2Lc,277
6
- intuned_cli/commands/attempt_authsession_create_command.py,sha256=tgnBqtboV2PRfGGr0kxTVo6yAOf2M2kD1DBlwNPW7pA,1703
7
- intuned_cli/commands/attempt_command.py,sha256=7NZC2dXA8GViCH3ZS2PMziR43hv2RmS6-jgW7l9bu40,253
8
- intuned_cli/commands/command.py,sha256=b0OlQIFhoCjCo5QIerfysccBKcU9iIsvqiU7oxshA2M,727
9
- intuned_cli/commands/deploy_command.py,sha256=vZQy6AJUuyfdsM_7DIvMIBhmk7RUxBsUDLOB8uPNzVw,1549
10
- intuned_cli/commands/init_command.py,sha256=JIDr9vY_SRKCvVbXE_lCEeHQlmC48LMZz0cghMPAs90,492
11
- intuned_cli/commands/run_api_command.py,sha256=Hwltx9eMEzksUoZUcpzTe2teGSD7tyu8f08uXSGBJOs,3008
12
- intuned_cli/commands/run_authsession_command.py,sha256=kM_TANy8M3yx8iBUsgSDO42byzccikLOd9KJfytfLmQ,269
13
- intuned_cli/commands/run_authsession_create_command.py,sha256=kVxQR8j8yARGRKY2FyUhW_E3hRA3KmGzP2zG3gVLRBc,2084
14
- intuned_cli/commands/run_authsession_update_command.py,sha256=vK3rJcHkqL-mVfL5IGrLb_4tWRQ6xpufwXymBr0kTCw,2140
15
- intuned_cli/commands/run_authsession_validate_command.py,sha256=lri5CyV-1cHOgKa83BTHHLeMT6_xlpbkS5vH1pUjHNA,2003
16
- intuned_cli/commands/run_command.py,sha256=JN1yCewcyb4zFquMcv0wEZ_aRmhJZIBMheY8L9yBeDE,245
17
- intuned_cli/commands/save_command.py,sha256=iW8i42B_NBrhmuGveV0XXkhaKW0Xx63ofOgMfH1FxTM,1543
1
+ intuned_cli/__init__.py,sha256=00r4AkrKFEzybNb4LWRZGSi3evyX9adVC6LoFItP5Ls,1208
2
+ intuned_cli/commands/__init__.py,sha256=AiCFfIDmlliLvz-eebZ-oh-PgCMF3jA8dH4n9t4BgUE,1779
3
+ intuned_cli/commands/attempt_api_command.py,sha256=oBPxiqsc8_J5YSXpuG4bj_HBzHhHehGiP2P-J9ZSvMA,2401
4
+ intuned_cli/commands/attempt_authsession_check_command.py,sha256=L4oB7wl6ntAH2PMzWNNMqso6Zit7ts2HjXzqmdC8vzI,1781
5
+ intuned_cli/commands/attempt_authsession_command.py,sha256=Qo9sj2mE27ha_XSGCfHhfqLybQzOaP0TjABagBkJkzs,282
6
+ intuned_cli/commands/attempt_authsession_create_command.py,sha256=QT1-apHhDaxI3FMNUWApctpN6K694SsOkAwqS9vPRVg,2170
7
+ intuned_cli/commands/attempt_command.py,sha256=HEic_NyrDFoTENtiF3UpJpxoxXHNXTd5yMCJjMNPyaI,258
8
+ intuned_cli/commands/authsession_command.py,sha256=coHm9k23_aucxYnW08uSdMe0e_WXRwthbdQBXEUkmic,254
9
+ intuned_cli/commands/authsession_record_command.py,sha256=B__J9T8qFQ-YFTuQPijdA41iq6-eZC-JpTQGoCuZLu0,2423
10
+ intuned_cli/commands/command.py,sha256=cZLdhtdLXakhZ8Qbv6joqpD4AGgf30FYl9dc1KR3x6M,815
11
+ intuned_cli/commands/deploy_command.py,sha256=D_CkGH0e1-vNEFd0y-0KFiquxviTYIAs_3Ba6DNj_Vo,1612
12
+ intuned_cli/commands/init_command.py,sha256=XDf2ilNzqT43u0nn3GoM_L4VU9lfyxKpx2eTXtig_jI,555
13
+ intuned_cli/commands/run_api_command.py,sha256=vcd4xLh0tEfBnk_qE5rg2LY8T2szASLMNzU7HsUI1BE,3451
14
+ intuned_cli/commands/run_authsession_command.py,sha256=e_u4WWSDVZKCbK4wcuqqhWTdNrsjcLXaeUx8sIYjhkQ,274
15
+ intuned_cli/commands/run_authsession_create_command.py,sha256=5VXDQRnShZhF89drZi6f3Ynb6i-b127IByDMf3mmIoU,3449
16
+ intuned_cli/commands/run_authsession_update_command.py,sha256=1MBJ5-Z6TeLXgGX5pnVo2AYzRjTs7hFNADdzb0fuXPc,3501
17
+ intuned_cli/commands/run_authsession_validate_command.py,sha256=zoLoyEMVUFsORDB9pf0HnvcMrnGZVgoO3OT75UQCae4,3355
18
+ intuned_cli/commands/run_command.py,sha256=Q4-r_IIvGjuXoo-OSOq23aGDiJVoyfhtIMsp7XI11jU,250
19
+ intuned_cli/commands/save_command.py,sha256=xm4132hSxAKdA7IGKUSpaDw3A7Dn9Lim5eBb-Vz69I0,1606
18
20
  intuned_cli/controller/__test__/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
- intuned_cli/controller/__test__/test_api.py,sha256=yuKxW6yWlAs1Pj6QBJ4DyryR8A8suG-A7xtBiUcMJ-E,19242
20
- intuned_cli/controller/__test__/test_authsession.py,sha256=y7O3dkDPHZTf2W7WRLEhysYYRati0hg93-J8BvGjRUM,35110
21
- intuned_cli/controller/api.py,sha256=cIxfuKsMibn7XRbTQCELy1QVtWH-UMWO8KGyOCvKx2A,7135
22
- intuned_cli/controller/authsession.py,sha256=KGpRYXO9W6DFbuM1ofdH5aba0Zs4A_A3nhbNj-KaCE8,14272
23
- intuned_cli/controller/deploy.py,sha256=krbVm0-c1XDIsiOPIf0lesFmFuVF_VfGYNWCOQ70Mmo,5452
24
- intuned_cli/controller/save.py,sha256=_ujsh4C9cgFGW4GTkj43JDSpIq0TuBLhZRJsH_1wgX8,9025
25
- intuned_cli/types.py,sha256=A053bHBqgVUG5wdHygwlJ2F-XeJIhFRidSOij5veBOQ,394
26
- intuned_cli/utils/api_helpers.py,sha256=q_xJMcl-RMccdTNTyDFu27T4OrXihhZtshYdZDiSDGI,1118
27
- intuned_cli/utils/auth_session_helpers.py,sha256=acKAPUjOfdybstLur4Lk3huaLFP2Ipl4AjPSqQPQLzY,1899
28
- intuned_cli/utils/backend.py,sha256=RvaDClFDf_Tur1E4Z_HoxM1hsHYpm_CWG0ju77ZyKZo,1026
21
+ intuned_cli/controller/__test__/test_api.py,sha256=CgPUTsdQZ6r4it8yU1JG96TiN1WKyeUMh__7UICg36k,24489
22
+ intuned_cli/controller/__test__/test_authsession.py,sha256=fvkqm1B39kAxgb1iLXs4WlcVNzn3P6hvlvNS4IrdBgQ,52491
23
+ intuned_cli/controller/api.py,sha256=GDBSn7J0567ziBLNEk6tiguUDLwUTvDU6kmMqifYKMQ,7511
24
+ intuned_cli/controller/authsession.py,sha256=rx5qRaKp4ED3OArD8_qCDGjKqgy1Pc5s9YYfm6bxe-I,18688
25
+ intuned_cli/controller/deploy.py,sha256=CFQ3MBEEsJ39JzINiOBgcxGGGQnuARz2TiRL1wsDRKo,5490
26
+ intuned_cli/controller/save.py,sha256=xdo8d_bZ_CBTm0nleZXoyTSbl6Xee_acQgstoSYlArI,9526
27
+ intuned_cli/types.py,sha256=1BKCukVvn2i37-onpZ9rFLrcVh4kWW_ui0DzOIKugtI,704
28
+ intuned_cli/utils/__test__/test_browser.py,sha256=NCv7OplirDxAjBpnfZharOa5O0fVNWA9xU3I1GVWB5M,4474
29
+ intuned_cli/utils/__test__/test_traces.py,sha256=4EfzwizBt7VT9-dANMdBYFKQTPzPWMDnodSVyT5F4dY,901
30
+ intuned_cli/utils/api_helpers.py,sha256=DKhBvri6lh6A4E86Wzo_eVcKZYTeWbTk3rjtj-8nGHc,2608
31
+ intuned_cli/utils/auth_session_helpers.py,sha256=92BL-UsP_dYSoGEsy7eDuDqMBrJ9Pucq-AL84IcpFAo,3593
32
+ intuned_cli/utils/backend.py,sha256=nl6ngRS0_nRPOc9FZWfcMol7twUCrdM1OiTue6LYZwA,1151
33
+ intuned_cli/utils/browser.py,sha256=l9n6JTupiG0QWUgyDbHTRO1VMwhlWOTJofzevgsOAfs,2004
29
34
  intuned_cli/utils/confirmation.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
30
35
  intuned_cli/utils/console.py,sha256=jgin2xB-0kpANPMoiDBOnWhrc8Ey5zT4IHRxQa8f5CQ,93
31
- intuned_cli/utils/error.py,sha256=KzqWG0e8PLerCY-AL534zygCLbIBD6uReo2WEuej-EA,990
32
- intuned_cli/utils/exclusions.py,sha256=Qe7NkWA3lsX73dOC9WprdD0KyYc_vuiwkrUCwD105gk,796
36
+ intuned_cli/utils/error.py,sha256=A6OZ5TX95RbOvQFWipAPCoxjZpT8j4oP8oKlTabqt6Q,1281
37
+ intuned_cli/utils/exclusions.py,sha256=bdjEnqqK1rPCkPLRYQzOPeFC0VANeMYRtEIHbAnL9sg,813
33
38
  intuned_cli/utils/get_auth_parameters.py,sha256=HmMSjBE8bPulkUdX319Ipr383Ko2Gtz3y8_WT9CK3Kw,798
39
+ intuned_cli/utils/help.py,sha256=NKTQCzaIINQsGHljJH68HemAVThbkKU3IQfxyRyVaD0,223
34
40
  intuned_cli/utils/import_function.py,sha256=UmE2yw5std1ENMFdBU-TUBuQ01qsv7Qr5ElnAhqE6Yc,453
35
41
  intuned_cli/utils/timeout.py,sha256=DkoeoU9XvKKKSQ06CpwqcNvxWqLPAOVuAMw6kSr4Tuo,886
36
- intuned_internal_cli/__init__.py,sha256=MLkUSYcMp4qMvCHeRgsPDzUlz10XwiAHAsgoNvzl6MA,1468
42
+ intuned_cli/utils/traces.py,sha256=Du_FnvSq-StLsAIQKSNyNSwkoMS-J93Tb6Ln4QgXVTE,793
43
+ intuned_cli/utils/wrapper.py,sha256=A_WgbzHYSZYNCoubjR7HNJUfv5--B2QfVW0XOCiO5r0,2045
44
+ intuned_internal_cli/__init__.py,sha256=bcL7-SPWCE0SmszoBoEvcyf-wAGRHAzIRe7vlCq3NPA,1760
37
45
  intuned_internal_cli/commands/__init__.py,sha256=gZ-r8UIXvRakeCfvmOZCNWr8CJHBcYzRzbMjyKYPXV0,1003
38
46
  intuned_internal_cli/commands/ai_source/__init__.py,sha256=lg7owgcK8owNn2a4VBUP9RKxzFsLruhtnnQV0F_z6pc,149
39
47
  intuned_internal_cli/commands/ai_source/ai_source.py,sha256=2woQtCmhxKvLfEz832eUoCT9gMsuSvEE6rMnHSYXC7w,138
@@ -71,7 +79,7 @@ runtime/browser/extensions/intuned_extension.py,sha256=_La0ikQX2isdiBgZXkZt2iQ6e
71
79
  runtime/browser/helpers.py,sha256=CwgiBToawPgwAY9nIGkGHW544N7Db_OgKmS-SHkN2pU,1255
72
80
  runtime/browser/launch_browser.py,sha256=ym97J4RffOGUwhi9iNjAR5Ek2f8pKiAtAcDQFSqMJw0,1899
73
81
  runtime/browser/launch_camoufox.py,sha256=TBOAwwipNGlbtMdFYnGkVM0ppLU44vWNkMGZA5uPZCE,1787
74
- runtime/browser/launch_chromium.py,sha256=uKX12nclua-tcW6_dgJvihq4MrcC0tnsgcndKSLWm_M,8002
82
+ runtime/browser/launch_chromium.py,sha256=CetUfwod8JFrpsbePwQqyifw8ofx3jDXR6u9KMxJzJo,8305
75
83
  runtime/browser/storage_state.py,sha256=fwLg8sP-H-vgt_6AJKNl03CpgyMVCQWWcN2cqswTQMs,3603
76
84
  runtime/constants.py,sha256=YMYQgCWZdJXUpxz_IN2TvZO5rFye9k_Lk9CS8m-shLg,34
77
85
  runtime/context/__init__.py,sha256=hg8ejm4bJy4tNkwmZ9lKgYJx6bU7OgOdBS684Uv5XGg,73
@@ -99,13 +107,13 @@ runtime/run/types.py,sha256=RR4RGiYVBIK6f2qXvzfLhQMZ8kmrziu265k5eqoIh98,346
99
107
  runtime/types/__init__.py,sha256=LWf5iOMgbve_BrpVP-LWWzDD3v2K4Y2sLxthOnVEqyY,539
100
108
  runtime/types/payload.py,sha256=sty8HgDEn3nJbZrwEOMCXyuG7_ICGDwlBIIWSON5ABY,124
101
109
  runtime/types/run_types.py,sha256=GcYLkL2BHxOjT4O3KvBP6xjBKsmJbjltMt_5bCVnfCI,4554
102
- runtime/types/settings_types.py,sha256=KWCxrQBlvJ8cmOJ2w1qd0-R5ypKlJLFJ5aiRh3BAluU,2486
110
+ runtime/types/settings_types.py,sha256=lgu3O-LXSa1Gbv1j6Uzd5udpSFBl2KR9T4vRVWITVfk,2832
103
111
  runtime/utils/__init__.py,sha256=v0qHjnc54YCkY1yPbXuihgymVZau_15xaEVyaFQj9ts,78
104
112
  runtime/utils/config_loader.py,sha256=yqk2eDGbgyw0Xslgd3dJbB28NjUe02L9LyCxzCmH9r4,482
105
113
  runtime_helpers/__init__.py,sha256=1BPzEc-qC2WAYiCWDOJChpgnFyO3ZNYRKHEZqdHUGwM,322
106
114
  runtime_helpers/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
107
- intuned_runtime-1.3.0rc0.dist-info/METADATA,sha256=zmH_fbP08dee7FsL2b-eWC_BiPM3o48fEI862hmwZgk,5375
108
- intuned_runtime-1.3.0rc0.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
109
- intuned_runtime-1.3.0rc0.dist-info/entry_points.txt,sha256=ToMS2cqDeRmF1FGkflwoeD-Xz6jJV5p1zIbw9G7IxMg,85
110
- intuned_runtime-1.3.0rc0.dist-info/licenses/LICENSE,sha256=9LIjQdgyU_ptzNIfItNCR7VmEHqYnrY1f1XwOreKFI0,3714
111
- intuned_runtime-1.3.0rc0.dist-info/RECORD,,
115
+ intuned_runtime-1.3.2.dist-info/METADATA,sha256=octnZbDG6RfYfHhnElBIZxL_v4b1ZaASmPgETnPHDyo,5473
116
+ intuned_runtime-1.3.2.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
117
+ intuned_runtime-1.3.2.dist-info/entry_points.txt,sha256=ToMS2cqDeRmF1FGkflwoeD-Xz6jJV5p1zIbw9G7IxMg,85
118
+ intuned_runtime-1.3.2.dist-info/licenses/LICENSE,sha256=9LIjQdgyU_ptzNIfItNCR7VmEHqYnrY1f1XwOreKFI0,3714
119
+ intuned_runtime-1.3.2.dist-info/RECORD,,
@@ -47,11 +47,6 @@ async def create_user_dir_with_preferences():
47
47
  return await user_dir.absolute(), await playwright_temp_dir.absolute()
48
48
 
49
49
 
50
- default_user_agent = (
51
- "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36"
52
- )
53
-
54
-
55
50
  @asynccontextmanager
56
51
  async def launch_chromium(
57
52
  headless: bool = True,
@@ -61,6 +56,7 @@ async def launch_chromium(
61
56
  *,
62
57
  proxy: "ProxySettings | None" = None,
63
58
  viewport: "ViewportSize | None" = None,
59
+ app_mode_initial_url: str | None = None,
64
60
  **kwargs: Any,
65
61
  ):
66
62
  from playwright.async_api import async_playwright
@@ -85,6 +81,9 @@ async def launch_chromium(
85
81
  if cdp_port:
86
82
  extra_args.append(f"--remote-debugging-port={cdp_port}")
87
83
 
84
+ if app_mode_initial_url:
85
+ extra_args.append(f"--app={app_mode_initial_url}")
86
+
88
87
  args_to_ignore = [
89
88
  "--disable-extensions",
90
89
  "--disable-component-extensions-with-background-pages",
@@ -108,7 +107,6 @@ async def launch_chromium(
108
107
  viewport=viewport,
109
108
  proxy=proxy,
110
109
  ignore_default_args=args_to_ignore,
111
- user_agent=os.environ.get("USER_AGENT", default_user_agent),
112
110
  args=extra_args,
113
111
  **kwargs,
114
112
  )
@@ -172,7 +170,21 @@ async def dangerous_launch_chromium(
172
170
  # set view port for the already existing pages and any new pages
173
171
  for page in context.pages:
174
172
  await page.set_viewport_size(kwargs.get("viewport", {"width": 1280, "height": 800}))
175
- context.on("page", lambda page: page.set_viewport_size(kwargs.get("viewport", {"width": 1280, "height": 800})))
173
+
174
+ async def set_viewport_size(page):
175
+ # check if the page is already closed
176
+ if page.is_closed():
177
+ return
178
+ try:
179
+ await page.set_viewport_size(kwargs.get("viewport", {"width": 1280, "height": 800}))
180
+ except Exception as e:
181
+ # check if the error because page closed then we don't need to raise an error
182
+ if page.is_closed():
183
+ return
184
+ else:
185
+ raise e
186
+
187
+ context.on("page", set_viewport_size)
176
188
  user_preferences_dir = None
177
189
  dir_to_clean = None
178
190
  else:
@@ -199,7 +211,6 @@ async def dangerous_launch_chromium(
199
211
  headless=headless,
200
212
  viewport=viewport,
201
213
  proxy=proxy_env,
202
- user_agent=os.environ.get("USER_AGENT", default_user_agent),
203
214
  args=extra_args,
204
215
  **kwargs,
205
216
  )
@@ -1,4 +1,5 @@
1
1
  from typing import List
2
+ from typing import Literal
2
3
 
3
4
  from pydantic import BaseModel
4
5
  from pydantic import Field
@@ -51,13 +52,21 @@ class CaptchaSolverSettings(BaseModel):
51
52
  )
52
53
 
53
54
 
55
+ class IntunedJsonDisabledAuthSessions(BaseModel):
56
+ enabled: Literal[False]
57
+
58
+
59
+ class IntunedJsonEnabledAuthSessions(BaseModel):
60
+ enabled: Literal[True]
61
+ type: Literal["API", "MANUAL"]
62
+ start_url: str | None = Field(default=None, alias="startUrl")
63
+ finish_url: str | None = Field(default=None, alias="finishUrl")
64
+
65
+
54
66
  class IntunedJson(BaseModel):
55
67
  model_config = {"populate_by_name": True}
56
68
 
57
- class _AuthSessions(BaseModel):
58
- enabled: bool
59
-
60
- auth_sessions: _AuthSessions = Field(alias="authSessions")
69
+ auth_sessions: IntunedJsonDisabledAuthSessions | IntunedJsonEnabledAuthSessions = Field(alias="authSessions")
61
70
  project_name: str | None = Field(alias="projectName", default=None)
62
71
  workspace_id: str | None = Field(alias="workspaceId", default=None)
63
72
  captcha_solver: CaptchaSolverSettings | None = Field(alias="captchaSolver", default=None)