clerk-sdk 0.5.4__py3-none-any.whl → 0.5.6__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.
- clerk/__init__.py +1 -1
- clerk/gui_automation/client_actor/client_actor.py +27 -9
- clerk/gui_automation/client_actor/exception.py +16 -0
- {clerk_sdk-0.5.4.dist-info → clerk_sdk-0.5.6.dist-info}/METADATA +1 -1
- {clerk_sdk-0.5.4.dist-info → clerk_sdk-0.5.6.dist-info}/RECORD +8 -8
- {clerk_sdk-0.5.4.dist-info → clerk_sdk-0.5.6.dist-info}/WHEEL +0 -0
- {clerk_sdk-0.5.4.dist-info → clerk_sdk-0.5.6.dist-info}/entry_points.txt +0 -0
- {clerk_sdk-0.5.4.dist-info → clerk_sdk-0.5.6.dist-info}/licenses/LICENSE +0 -0
clerk/__init__.py
CHANGED
|
@@ -19,7 +19,12 @@ from .model import (
|
|
|
19
19
|
)
|
|
20
20
|
|
|
21
21
|
from .model import PerformActionResponse, ActionStates
|
|
22
|
-
from .exception import
|
|
22
|
+
from .exception import (
|
|
23
|
+
PerformActionException,
|
|
24
|
+
GetScreenError,
|
|
25
|
+
AckTimeoutError,
|
|
26
|
+
ActionTimeoutError,
|
|
27
|
+
)
|
|
23
28
|
|
|
24
29
|
|
|
25
30
|
async def before_retry(details: Any):
|
|
@@ -35,6 +40,13 @@ async def before_retry(details: Any):
|
|
|
35
40
|
max_tries=5,
|
|
36
41
|
on_backoff=before_retry,
|
|
37
42
|
)
|
|
43
|
+
@backoff.on_exception(
|
|
44
|
+
backoff.constant,
|
|
45
|
+
(ActionTimeoutError, AckTimeoutError),
|
|
46
|
+
interval=10,
|
|
47
|
+
max_tries=2,
|
|
48
|
+
on_backoff=before_retry,
|
|
49
|
+
)
|
|
38
50
|
async def _perform_action_ws(payload: Dict[str, Any]) -> PerformActionResponse:
|
|
39
51
|
"""Perform an action over a WebSocket connection.
|
|
40
52
|
|
|
@@ -56,16 +68,22 @@ async def _perform_action_ws(payload: Dict[str, Any]) -> PerformActionResponse:
|
|
|
56
68
|
|
|
57
69
|
# 2. wait for ack message
|
|
58
70
|
try:
|
|
59
|
-
ack = await asyncio.wait_for(global_ws.recv(),
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
return PerformActionResponse(**json.loads(action_info))
|
|
63
|
-
else:
|
|
64
|
-
raise RuntimeError("Received ACK != OK")
|
|
71
|
+
ack = await asyncio.wait_for(global_ws.recv(), 120)
|
|
72
|
+
except asyncio.TimeoutError:
|
|
73
|
+
raise AckTimeoutError("Timeout waiting for ACK message")
|
|
65
74
|
except WebSocketException as e:
|
|
66
75
|
raise e
|
|
67
|
-
|
|
68
|
-
|
|
76
|
+
|
|
77
|
+
if ack == "OK":
|
|
78
|
+
try:
|
|
79
|
+
action_info = await asyncio.wait_for(global_ws.recv(), 120)
|
|
80
|
+
except asyncio.TimeoutError:
|
|
81
|
+
raise ActionTimeoutError("Timeout waiting for action response")
|
|
82
|
+
except WebSocketException as e:
|
|
83
|
+
raise e
|
|
84
|
+
return PerformActionResponse(**json.loads(action_info))
|
|
85
|
+
else:
|
|
86
|
+
raise RuntimeError("Received ACK != OK")
|
|
69
87
|
else:
|
|
70
88
|
raise RuntimeError("The Websocket has not been initiated.")
|
|
71
89
|
|
|
@@ -20,3 +20,19 @@ class WebSocketConnectionFailed(Exception):
|
|
|
20
20
|
"""
|
|
21
21
|
|
|
22
22
|
pass
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class AckTimeoutError(Exception):
|
|
26
|
+
"""
|
|
27
|
+
Timeout waiting for ACK message from WebSocket.
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
pass
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class ActionTimeoutError(Exception):
|
|
34
|
+
"""
|
|
35
|
+
Timeout waiting for action response from WebSocket.
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
pass
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
clerk/__init__.py,sha256=
|
|
1
|
+
clerk/__init__.py,sha256=htiVGLGz-FhPfTF3lUtC9DGzouJJEiqE9G8SbxLOHDk,50
|
|
2
2
|
clerk/base.py,sha256=lbFTdpdDfsmYIQUFH93S1aw0-L6GNJwAcubW1tdMFX4,3967
|
|
3
3
|
clerk/client.py,sha256=JGhDUb4m8R7ZTHLxFsAwAw0vNA1kxewg5-GC6qOFYDk,5244
|
|
4
4
|
clerk/decorator/__init__.py,sha256=yGGcS17VsZ7cZ-hVGCm3I3vGDJMiJIAqmDGzriIi0DI,65
|
|
@@ -30,8 +30,8 @@ clerk/gui_automation/action_model/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeR
|
|
|
30
30
|
clerk/gui_automation/action_model/model.py,sha256=yzaCyEMOH3YMkPBf6IwUMuu69-xyf78HzmthiewgWQY,3811
|
|
31
31
|
clerk/gui_automation/action_model/utils.py,sha256=xzFxgN-bTK6HKGS7J-esQZ-ePj_yG72T-2ZVhcWvKjw,798
|
|
32
32
|
clerk/gui_automation/client_actor/__init__.py,sha256=SVuL6-oo1Xc0oJkjMKrO6mJwpPGjrCLKhDV6r2Abtf8,66
|
|
33
|
-
clerk/gui_automation/client_actor/client_actor.py,sha256=
|
|
34
|
-
clerk/gui_automation/client_actor/exception.py,sha256=
|
|
33
|
+
clerk/gui_automation/client_actor/client_actor.py,sha256=MaejYln5Ya21L5M_DNmE8xsoW9LwnkqGnd_SL0CNwCA,5882
|
|
34
|
+
clerk/gui_automation/client_actor/exception.py,sha256=Z66TwaoplRL3VKy3y6V-G0tnQFkjytXEFUQMhQDHwJo,642
|
|
35
35
|
clerk/gui_automation/client_actor/model.py,sha256=wVpFCi1w2kh4kAV8oNx489vf_SLUQnqhc02rFD5NIJA,6335
|
|
36
36
|
clerk/gui_automation/decorators/__init__.py,sha256=OCgXStEumscgT-RyVy5OKS7ml1w9y-lEnjCVnxuRnQs,43
|
|
37
37
|
clerk/gui_automation/decorators/gui_automation.py,sha256=CwfDmTP9d4BOEsQS4_YGwOoz1gbDwYsA-JVnXz25Cto,3680
|
|
@@ -63,8 +63,8 @@ clerk/models/ui_operator.py,sha256=mKTJUFZgv7PeEt5oys28HVZxHOJsofmRQOcRpqj0dbU,2
|
|
|
63
63
|
clerk/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
64
64
|
clerk/utils/logger.py,sha256=NrMIlJfVmRjjRw_N_Jngkl0qqv7btXUbg5wxcRmFEH4,3800
|
|
65
65
|
clerk/utils/save_artifact.py,sha256=94aYkYNVGcSUaSWZmdjiY6Oc-3yCKb2XWCZ56IAXQqk,1158
|
|
66
|
-
clerk_sdk-0.5.
|
|
67
|
-
clerk_sdk-0.5.
|
|
68
|
-
clerk_sdk-0.5.
|
|
69
|
-
clerk_sdk-0.5.
|
|
70
|
-
clerk_sdk-0.5.
|
|
66
|
+
clerk_sdk-0.5.6.dist-info/METADATA,sha256=gzzcJIy0xp2JJxoyby4AahaXMIgVpbbxA0iYR8HRjXc,9635
|
|
67
|
+
clerk_sdk-0.5.6.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
68
|
+
clerk_sdk-0.5.6.dist-info/entry_points.txt,sha256=VoUmW07sRRSioms5pqQ4A6CYxNEyhGA93GtyBlB_wGw,53
|
|
69
|
+
clerk_sdk-0.5.6.dist-info/licenses/LICENSE,sha256=GTVQl3vH6ht70wJXKC0yMT8CmXKHxv_YyO_utAgm7EA,1065
|
|
70
|
+
clerk_sdk-0.5.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|