pywmspro 0.3.2__tar.gz → 0.3.3__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pywmspro
3
- Version: 0.3.2
3
+ Version: 0.3.3
4
4
  Summary: Python library for WMS WebControl pro API
5
5
  Author-email: Marc Hoersken <info@marc-hoersken.de>
6
6
  License-Expression: Apache-2.0
@@ -6,6 +6,22 @@ from .const import (
6
6
  )
7
7
 
8
8
 
9
+ class ActionList(list):
10
+ def __init__(self, control) -> None:
11
+ super().__init__()
12
+ self._control = control
13
+
14
+ async def __call__(
15
+ self, responseType=WMS_WebControl_pro_API_responseType.Instant
16
+ ) -> Any:
17
+ if len(self) == 0:
18
+ raise ValueError("ActionList is empty")
19
+ return await self._control._action(
20
+ actions=self,
21
+ responseType=responseType,
22
+ )
23
+
24
+
9
25
  class Action:
10
26
  def __init__(
11
27
  self, dest, id: int, actionType: int, actionDescription: int, **kwargs
@@ -62,17 +78,20 @@ class Action:
62
78
  def __getitem__(self, name: str) -> Any:
63
79
  return self._params.get(name)
64
80
 
81
+ def prep(self, **kwargs) -> ActionList:
82
+ actionList = ActionList(self._dest._control)
83
+ actionList.append({
84
+ "destinationId": self._dest.id,
85
+ "actionId": self.id,
86
+ "parameters": kwargs,
87
+ })
88
+ return actionList
89
+
65
90
  async def __call__(
66
91
  self, responseType=WMS_WebControl_pro_API_responseType.Instant, **kwargs
67
92
  ) -> Any:
68
93
  return await self._dest._control._action(
69
- actions=[
70
- {
71
- "destinationId": self._dest.id,
72
- "actionId": self.id,
73
- "parameters": kwargs,
74
- }
75
- ],
94
+ actions=self.prep(**kwargs),
76
95
  responseType=responseType,
77
96
  )
78
97
 
@@ -159,6 +159,14 @@ async def async_main_test():
159
159
  )
160
160
  print(response)
161
161
 
162
+ action_list = action.prep(percentage=100)
163
+ action_list += action.prep(percentage=0)
164
+ print(action_list)
165
+ response = await action_list(
166
+ responseType=WMS_WebControl_pro_API_responseType.Detailed
167
+ )
168
+ print(response)
169
+
162
170
  pprint.pprint(control.diag())
163
171
 
164
172
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes