python-kasa 0.7.2__py3-none-any.whl → 0.7.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 (183) hide show
  1. kasa/aestransport.py +11 -2
  2. kasa/cli/device.py +12 -1
  3. kasa/device.py +15 -0
  4. kasa/deviceconfig.py +11 -2
  5. kasa/iot/iotbulb.py +1 -1
  6. kasa/iot/iotdevice.py +7 -0
  7. kasa/smart/modules/alarm.py +7 -5
  8. {python_kasa-0.7.2.dist-info → python_kasa-0.7.4.dist-info}/METADATA +30 -27
  9. python_kasa-0.7.4.dist-info/RECORD +104 -0
  10. {python_kasa-0.7.2.dist-info → python_kasa-0.7.4.dist-info}/WHEEL +1 -1
  11. python_kasa-0.7.4.dist-info/entry_points.txt +2 -0
  12. kasa/tests/__init__.py +0 -0
  13. kasa/tests/conftest.py +0 -107
  14. kasa/tests/device_fixtures.py +0 -473
  15. kasa/tests/discovery_fixtures.py +0 -256
  16. kasa/tests/fakeprotocol_iot.py +0 -461
  17. kasa/tests/fakeprotocol_smart.py +0 -409
  18. kasa/tests/fixtureinfo.py +0 -172
  19. kasa/tests/fixtures/EP10(US)_1.0_1.0.2.json +0 -32
  20. kasa/tests/fixtures/EP40(US)_1.0_1.0.2.json +0 -45
  21. kasa/tests/fixtures/ES20M(US)_1.0_1.0.8.json +0 -126
  22. kasa/tests/fixtures/HS100(UK)_1.0_1.2.6.json +0 -28
  23. kasa/tests/fixtures/HS100(UK)_4.1_1.1.0.json +0 -47
  24. kasa/tests/fixtures/HS100(US)_1.0_1.2.5.json +0 -44
  25. kasa/tests/fixtures/HS100(US)_2.0_1.5.6.json +0 -49
  26. kasa/tests/fixtures/HS103(US)_1.0_1.5.7.json +0 -52
  27. kasa/tests/fixtures/HS103(US)_2.1_1.1.2.json +0 -47
  28. kasa/tests/fixtures/HS103(US)_2.1_1.1.4.json +0 -31
  29. kasa/tests/fixtures/HS105(US)_1.0_1.5.6.json +0 -49
  30. kasa/tests/fixtures/HS107(US)_1.0_1.0.8.json +0 -59
  31. kasa/tests/fixtures/HS110(EU)_1.0_1.2.5.json +0 -37
  32. kasa/tests/fixtures/HS110(EU)_4.0_1.0.4.json +0 -40
  33. kasa/tests/fixtures/HS110(US)_1.0_1.2.6.json +0 -37
  34. kasa/tests/fixtures/HS200(US)_2.0_1.5.7.json +0 -49
  35. kasa/tests/fixtures/HS200(US)_5.0_1.0.2.json +0 -31
  36. kasa/tests/fixtures/HS210(US)_1.0_1.5.8.json +0 -50
  37. kasa/tests/fixtures/HS220(US)_1.0_1.5.7.json +0 -76
  38. kasa/tests/fixtures/HS220(US)_2.0_1.0.3.json +0 -64
  39. kasa/tests/fixtures/HS300(US)_1.0_1.0.10.json +0 -100
  40. kasa/tests/fixtures/HS300(US)_1.0_1.0.21.json +0 -89
  41. kasa/tests/fixtures/HS300(US)_2.0_1.0.12.json +0 -90
  42. kasa/tests/fixtures/HS300(US)_2.0_1.0.3.json +0 -90
  43. kasa/tests/fixtures/KL110(US)_1.0_1.8.11.json +0 -89
  44. kasa/tests/fixtures/KL120(US)_1.0_1.8.11.json +0 -85
  45. kasa/tests/fixtures/KL120(US)_1.0_1.8.6.json +0 -93
  46. kasa/tests/fixtures/KL125(US)_1.20_1.0.5.json +0 -88
  47. kasa/tests/fixtures/KL125(US)_2.0_1.0.7.json +0 -92
  48. kasa/tests/fixtures/KL125(US)_4.0_1.0.5.json +0 -93
  49. kasa/tests/fixtures/KL130(EU)_1.0_1.8.8.json +0 -85
  50. kasa/tests/fixtures/KL130(US)_1.0_1.8.11.json +0 -89
  51. kasa/tests/fixtures/KL135(US)_1.0_1.0.6.json +0 -89
  52. kasa/tests/fixtures/KL400L5(US)_1.0_1.0.5.json +0 -57
  53. kasa/tests/fixtures/KL400L5(US)_1.0_1.0.8.json +0 -57
  54. kasa/tests/fixtures/KL420L5(US)_1.0_1.0.2.json +0 -57
  55. kasa/tests/fixtures/KL430(UN)_2.0_1.0.8.json +0 -90
  56. kasa/tests/fixtures/KL430(US)_1.0_1.0.10.json +0 -109
  57. kasa/tests/fixtures/KL430(US)_2.0_1.0.11.json +0 -59
  58. kasa/tests/fixtures/KL430(US)_2.0_1.0.8.json +0 -59
  59. kasa/tests/fixtures/KL430(US)_2.0_1.0.9.json +0 -57
  60. kasa/tests/fixtures/KL50(US)_1.0_1.1.13.json +0 -90
  61. kasa/tests/fixtures/KL60(UN)_1.0_1.1.4.json +0 -102
  62. kasa/tests/fixtures/KL60(US)_1.0_1.1.13.json +0 -90
  63. kasa/tests/fixtures/KP100(US)_3.0_1.0.1.json +0 -31
  64. kasa/tests/fixtures/KP105(UK)_1.0_1.0.5.json +0 -36
  65. kasa/tests/fixtures/KP105(UK)_1.0_1.0.7.json +0 -33
  66. kasa/tests/fixtures/KP115(EU)_1.0_1.0.16.json +0 -42
  67. kasa/tests/fixtures/KP115(US)_1.0_1.0.17.json +0 -42
  68. kasa/tests/fixtures/KP115(US)_1.0_1.0.21.json +0 -42
  69. kasa/tests/fixtures/KP125(US)_1.0_1.0.6.json +0 -42
  70. kasa/tests/fixtures/KP200(US)_3.0_1.0.3.json +0 -46
  71. kasa/tests/fixtures/KP303(UK)_1.0_1.0.3.json +0 -54
  72. kasa/tests/fixtures/KP303(US)_2.0_1.0.3.json +0 -54
  73. kasa/tests/fixtures/KP400(US)_1.0_1.0.10.json +0 -63
  74. kasa/tests/fixtures/KP400(US)_2.0_1.0.6.json +0 -45
  75. kasa/tests/fixtures/KP400(US)_3.0_1.0.3.json +0 -45
  76. kasa/tests/fixtures/KP400(US)_3.0_1.0.4.json +0 -46
  77. kasa/tests/fixtures/KP401(US)_1.0_1.0.0.json +0 -32
  78. kasa/tests/fixtures/KP405(US)_1.0_1.0.5.json +0 -65
  79. kasa/tests/fixtures/KP405(US)_1.0_1.0.6.json +0 -65
  80. kasa/tests/fixtures/KS200M(US)_1.0_1.0.11.json +0 -96
  81. kasa/tests/fixtures/KS200M(US)_1.0_1.0.8.json +0 -95
  82. kasa/tests/fixtures/KS220M(US)_1.0_1.0.4.json +0 -126
  83. kasa/tests/fixtures/KS230(US)_1.0_1.0.14.json +0 -64
  84. kasa/tests/fixtures/LB110(US)_1.0_1.8.11.json +0 -89
  85. kasa/tests/fixtures/smart/EP25(US)_2.6_1.0.1.json +0 -457
  86. kasa/tests/fixtures/smart/EP25(US)_2.6_1.0.2.json +0 -414
  87. kasa/tests/fixtures/smart/H100(EU)_1.0_1.2.3.json +0 -221
  88. kasa/tests/fixtures/smart/H100(EU)_1.0_1.5.10.json +0 -547
  89. kasa/tests/fixtures/smart/H100(EU)_1.0_1.5.5.json +0 -391
  90. kasa/tests/fixtures/smart/HS220(US)_3.26_1.0.1.json +0 -371
  91. kasa/tests/fixtures/smart/KH100(UK)_1.0_1.5.6.json +0 -1557
  92. kasa/tests/fixtures/smart/KP125M(US)_1.0_1.1.3.json +0 -175
  93. kasa/tests/fixtures/smart/KS205(US)_1.0_1.0.2.json +0 -243
  94. kasa/tests/fixtures/smart/KS205(US)_1.0_1.1.0.json +0 -298
  95. kasa/tests/fixtures/smart/KS225(US)_1.0_1.0.2.json +0 -269
  96. kasa/tests/fixtures/smart/KS225(US)_1.0_1.1.0.json +0 -332
  97. kasa/tests/fixtures/smart/KS240(US)_1.0_1.0.4.json +0 -899
  98. kasa/tests/fixtures/smart/KS240(US)_1.0_1.0.5.json +0 -479
  99. kasa/tests/fixtures/smart/L510B(EU)_3.0_1.0.5.json +0 -263
  100. kasa/tests/fixtures/smart/L510E(US)_3.0_1.0.5.json +0 -303
  101. kasa/tests/fixtures/smart/L510E(US)_3.0_1.1.2.json +0 -267
  102. kasa/tests/fixtures/smart/L530E(EU)_3.0_1.0.6.json +0 -425
  103. kasa/tests/fixtures/smart/L530E(EU)_3.0_1.1.0.json +0 -440
  104. kasa/tests/fixtures/smart/L530E(EU)_3.0_1.1.6.json +0 -449
  105. kasa/tests/fixtures/smart/L530E(US)_2.0_1.1.0.json +0 -439
  106. kasa/tests/fixtures/smart/L900-10(EU)_1.0_1.0.17.json +0 -441
  107. kasa/tests/fixtures/smart/L900-10(US)_1.0_1.0.11.json +0 -428
  108. kasa/tests/fixtures/smart/L900-5(EU)_1.0_1.0.17.json +0 -384
  109. kasa/tests/fixtures/smart/L900-5(EU)_1.0_1.1.0.json +0 -390
  110. kasa/tests/fixtures/smart/L920-5(EU)_1.0_1.0.7.json +0 -350
  111. kasa/tests/fixtures/smart/L920-5(EU)_1.0_1.1.3.json +0 -1085
  112. kasa/tests/fixtures/smart/L920-5(US)_1.0_1.1.0.json +0 -397
  113. kasa/tests/fixtures/smart/L920-5(US)_1.0_1.1.3.json +0 -415
  114. kasa/tests/fixtures/smart/L930-5(US)_1.0_1.1.2.json +0 -429
  115. kasa/tests/fixtures/smart/P100_1.0.0_1.1.3.json +0 -173
  116. kasa/tests/fixtures/smart/P100_1.0.0_1.3.7.json +0 -197
  117. kasa/tests/fixtures/smart/P100_1.0.0_1.4.0.json +0 -204
  118. kasa/tests/fixtures/smart/P110(EU)_1.0_1.0.7.json +0 -566
  119. kasa/tests/fixtures/smart/P110(EU)_1.0_1.2.3.json +0 -399
  120. kasa/tests/fixtures/smart/P110(UK)_1.0_1.3.0.json +0 -447
  121. kasa/tests/fixtures/smart/P115(EU)_1.0_1.2.3.json +0 -386
  122. kasa/tests/fixtures/smart/P125M(US)_1.0_1.1.0.json +0 -243
  123. kasa/tests/fixtures/smart/P135(US)_1.0_1.0.5.json +0 -317
  124. kasa/tests/fixtures/smart/P300(EU)_1.0_1.0.13.json +0 -510
  125. kasa/tests/fixtures/smart/P300(EU)_1.0_1.0.15.json +0 -966
  126. kasa/tests/fixtures/smart/P300(EU)_1.0_1.0.7.json +0 -512
  127. kasa/tests/fixtures/smart/S500D(US)_1.0_1.0.5.json +0 -317
  128. kasa/tests/fixtures/smart/S505(US)_1.0_1.0.2.json +0 -309
  129. kasa/tests/fixtures/smart/S505D(US)_1.0_1.1.0.json +0 -262
  130. kasa/tests/fixtures/smart/TP15(US)_1.0_1.0.3.json +0 -295
  131. kasa/tests/fixtures/smart/TP25(US)_1.0_1.0.2.json +0 -423
  132. kasa/tests/fixtures/smart/child/KE100(EU)_1.0_2.4.0.json +0 -170
  133. kasa/tests/fixtures/smart/child/KE100(EU)_1.0_2.8.0.json +0 -171
  134. kasa/tests/fixtures/smart/child/KE100(UK)_1.0_2.8.0.json +0 -171
  135. kasa/tests/fixtures/smart/child/T100(EU)_1.0_1.12.0.json +0 -537
  136. kasa/tests/fixtures/smart/child/T110(EU)_1.0_1.8.0.json +0 -526
  137. kasa/tests/fixtures/smart/child/T300(EU)_1.0_1.7.0.json +0 -533
  138. kasa/tests/fixtures/smart/child/T310(EU)_1.0_1.5.0.json +0 -530
  139. kasa/tests/fixtures/smart/child/T315(EU)_1.0_1.7.0.json +0 -537
  140. kasa/tests/smart/__init__.py +0 -0
  141. kasa/tests/smart/features/__init__.py +0 -0
  142. kasa/tests/smart/features/test_brightness.py +0 -57
  143. kasa/tests/smart/features/test_colortemp.py +0 -30
  144. kasa/tests/smart/modules/__init__.py +0 -0
  145. kasa/tests/smart/modules/test_autooff.py +0 -103
  146. kasa/tests/smart/modules/test_contact.py +0 -28
  147. kasa/tests/smart/modules/test_fan.py +0 -83
  148. kasa/tests/smart/modules/test_firmware.py +0 -149
  149. kasa/tests/smart/modules/test_humidity.py +0 -28
  150. kasa/tests/smart/modules/test_light_effect.py +0 -83
  151. kasa/tests/smart/modules/test_light_strip_effect.py +0 -98
  152. kasa/tests/smart/modules/test_lighttransition.py +0 -80
  153. kasa/tests/smart/modules/test_motionsensor.py +0 -28
  154. kasa/tests/smart/modules/test_temperature.py +0 -47
  155. kasa/tests/smart/modules/test_temperaturecontrol.py +0 -154
  156. kasa/tests/smart/modules/test_waterleak.py +0 -42
  157. kasa/tests/test_aestransport.py +0 -510
  158. kasa/tests/test_bulb.py +0 -481
  159. kasa/tests/test_childdevice.py +0 -122
  160. kasa/tests/test_cli.py +0 -1051
  161. kasa/tests/test_common_modules.py +0 -321
  162. kasa/tests/test_device.py +0 -301
  163. kasa/tests/test_device_factory.py +0 -193
  164. kasa/tests/test_device_type.py +0 -23
  165. kasa/tests/test_deviceconfig.py +0 -74
  166. kasa/tests/test_dimmer.py +0 -163
  167. kasa/tests/test_discovery.py +0 -603
  168. kasa/tests/test_emeter.py +0 -203
  169. kasa/tests/test_feature.py +0 -209
  170. kasa/tests/test_httpclient.py +0 -100
  171. kasa/tests/test_iotdevice.py +0 -313
  172. kasa/tests/test_klapprotocol.py +0 -563
  173. kasa/tests/test_lightstrip.py +0 -79
  174. kasa/tests/test_plug.py +0 -83
  175. kasa/tests/test_protocol.py +0 -738
  176. kasa/tests/test_readme_examples.py +0 -157
  177. kasa/tests/test_smartdevice.py +0 -432
  178. kasa/tests/test_smartprotocol.py +0 -446
  179. kasa/tests/test_strip.py +0 -162
  180. kasa/tests/test_usage.py +0 -86
  181. python_kasa-0.7.2.dist-info/RECORD +0 -273
  182. python_kasa-0.7.2.dist-info/entry_points.txt +0 -3
  183. {python_kasa-0.7.2.dist-info → python_kasa-0.7.4.dist-info/licenses}/LICENSE +0 -0
kasa/aestransport.py CHANGED
@@ -106,6 +106,9 @@ class AesTransport(BaseTransport):
106
106
  self._session_cookie: dict[str, str] | None = None
107
107
 
108
108
  self._key_pair: KeyPair | None = None
109
+ if config.aes_keys:
110
+ aes_keys = config.aes_keys
111
+ self._key_pair = KeyPair(aes_keys["private"], aes_keys["public"])
109
112
  self._app_url = URL(f"http://{self._host}:{self._port}/app")
110
113
  self._token_url: URL | None = None
111
114
 
@@ -271,7 +274,14 @@ class AesTransport(BaseTransport):
271
274
  can be made to the device.
272
275
  """
273
276
  _LOGGER.debug("Generating keypair")
274
- self._key_pair = KeyPair.create_key_pair()
277
+ if not self._key_pair:
278
+ kp = KeyPair.create_key_pair()
279
+ self._config.aes_keys = {
280
+ "private": kp.get_private_key(),
281
+ "public": kp.get_public_key(),
282
+ }
283
+ self._key_pair = kp
284
+
275
285
  pub_key = (
276
286
  "-----BEGIN PUBLIC KEY-----\n"
277
287
  + self._key_pair.get_public_key() # type: ignore[union-attr]
@@ -286,7 +296,6 @@ class AesTransport(BaseTransport):
286
296
  """Perform the handshake."""
287
297
  _LOGGER.debug("Will perform handshaking...")
288
298
 
289
- self._key_pair = None
290
299
  self._token_url = None
291
300
  self._session_expire_at = None
292
301
  self._session_cookie = None
kasa/cli/device.py CHANGED
@@ -99,7 +99,7 @@ async def on(dev: Device, transition: int):
99
99
  return await dev.turn_on(transition=transition)
100
100
 
101
101
 
102
- @click.command
102
+ @device.command
103
103
  @click.option("--transition", type=int, required=False)
104
104
  @pass_dev_or_child
105
105
  async def off(dev: Device, transition: int):
@@ -166,6 +166,17 @@ async def reboot(plug, delay):
166
166
  return await plug.reboot(delay)
167
167
 
168
168
 
169
+ @device.command()
170
+ @pass_dev
171
+ async def factory_reset(plug):
172
+ """Reset device to factory settings."""
173
+ click.confirm(
174
+ "Do you really want to reset the device to factory settings?", abort=True
175
+ )
176
+
177
+ return await plug.factory_reset()
178
+
179
+
169
180
  @device.command()
170
181
  @pass_dev
171
182
  @click.option(
kasa/device.py CHANGED
@@ -449,6 +449,21 @@ class Device(ABC):
449
449
  async def set_alias(self, alias: str):
450
450
  """Set the device name (alias)."""
451
451
 
452
+ @abstractmethod
453
+ async def reboot(self, delay: int = 1) -> None:
454
+ """Reboot the device.
455
+
456
+ Note that giving a delay of zero causes this to block,
457
+ as the device reboots immediately without responding to the call.
458
+ """
459
+
460
+ @abstractmethod
461
+ async def factory_reset(self) -> None:
462
+ """Reset device back to factory settings.
463
+
464
+ Note, this does not downgrade the firmware.
465
+ """
466
+
452
467
  def __repr__(self):
453
468
  if self._last_update is None:
454
469
  return f"<{self.device_type} at {self.host} - update() needed>"
kasa/deviceconfig.py CHANGED
@@ -34,7 +34,7 @@ Living Room Bulb
34
34
  import logging
35
35
  from dataclasses import asdict, dataclass, field, fields, is_dataclass
36
36
  from enum import Enum
37
- from typing import TYPE_CHECKING, Dict, Optional, Union
37
+ from typing import TYPE_CHECKING, Dict, Optional, TypedDict, Union
38
38
 
39
39
  from .credentials import Credentials
40
40
  from .exceptions import KasaException
@@ -45,6 +45,13 @@ if TYPE_CHECKING:
45
45
  _LOGGER = logging.getLogger(__name__)
46
46
 
47
47
 
48
+ class KeyPairDict(TypedDict):
49
+ """Class to represent a public/private key pair."""
50
+
51
+ private: str
52
+ public: str
53
+
54
+
48
55
  class DeviceEncryptionType(Enum):
49
56
  """Encrypt type enum."""
50
57
 
@@ -182,7 +189,7 @@ class DeviceConfig:
182
189
  #: The batch size for protoools supporting multiple request batches.
183
190
  connection_type: DeviceConnectionParameters = field(
184
191
  default_factory=lambda: DeviceConnectionParameters(
185
- DeviceFamily.IotSmartPlugSwitch, DeviceEncryptionType.Xor, 1
192
+ DeviceFamily.IotSmartPlugSwitch, DeviceEncryptionType.Xor
186
193
  )
187
194
  )
188
195
  #: True if the device uses http. Consumers should retrieve rather than set this
@@ -193,6 +200,8 @@ class DeviceConfig:
193
200
  #: Set a custom http_client for the device to use.
194
201
  http_client: Optional["ClientSession"] = field(default=None, compare=False)
195
202
 
203
+ aes_keys: Optional[KeyPairDict] = None
204
+
196
205
  def __post_init__(self):
197
206
  if self.connection_type is None:
198
207
  self.connection_type = DeviceConnectionParameters(
kasa/iot/iotbulb.py CHANGED
@@ -85,7 +85,7 @@ TPLINK_KELVIN = {
85
85
  "KB130": ColorTempRange(2500, 9000),
86
86
  "KL130": ColorTempRange(2500, 9000),
87
87
  "KL125": ColorTempRange(2500, 6500),
88
- "KL135": ColorTempRange(2500, 6500),
88
+ "KL135": ColorTempRange(2500, 9000),
89
89
  r"KL120\(EU\)": ColorTempRange(2700, 6500),
90
90
  r"KL120\(US\)": ColorTempRange(2700, 5000),
91
91
  r"KL430": ColorTempRange(2500, 9000),
kasa/iot/iotdevice.py CHANGED
@@ -561,6 +561,13 @@ class IotDevice(Device):
561
561
  """
562
562
  await self._query_helper("system", "reboot", {"delay": delay})
563
563
 
564
+ async def factory_reset(self) -> None:
565
+ """Reset device back to factory settings.
566
+
567
+ Note, this does not downgrade the firmware.
568
+ """
569
+ await self._query_helper("system", "reset")
570
+
564
571
  async def turn_off(self, **kwargs) -> dict:
565
572
  """Turn off the device."""
566
573
  raise NotImplementedError("Device subclass needs to implement this.")
@@ -2,6 +2,8 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
+ from typing import Literal
6
+
5
7
  from ...feature import Feature
6
8
  from ..smartmodule import SmartModule
7
9
 
@@ -94,7 +96,7 @@ class Alarm(SmartModule):
94
96
  )
95
97
 
96
98
  @property
97
- def alarm_sound(self):
99
+ def alarm_sound(self) -> str:
98
100
  """Return current alarm sound."""
99
101
  return self.data["get_alarm_configure"]["type"]
100
102
 
@@ -113,11 +115,11 @@ class Alarm(SmartModule):
113
115
  return self.data["get_support_alarm_type_list"]["alarm_type_list"]
114
116
 
115
117
  @property
116
- def alarm_volume(self):
118
+ def alarm_volume(self) -> Literal["low", "normal", "high"]:
117
119
  """Return alarm volume."""
118
120
  return self.data["get_alarm_configure"]["volume"]
119
121
 
120
- async def set_alarm_volume(self, volume: str):
122
+ async def set_alarm_volume(self, volume: Literal["low", "normal", "high"]):
121
123
  """Set alarm volume."""
122
124
  payload = self.data["get_alarm_configure"].copy()
123
125
  payload["volume"] = volume
@@ -134,10 +136,10 @@ class Alarm(SmartModule):
134
136
  src = self._device.sys_info["in_alarm_source"]
135
137
  return src if src else None
136
138
 
137
- async def play(self):
139
+ async def play(self) -> dict:
138
140
  """Play alarm."""
139
141
  return await self.call("play_alarm")
140
142
 
141
- async def stop(self):
143
+ async def stop(self) -> dict:
142
144
  """Stop alarm."""
143
145
  return await self.call("stop_alarm")
@@ -1,38 +1,41 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: python-kasa
3
- Version: 0.7.2
4
- Summary: Python API for TP-Link Kasa Smarthome devices
5
- Home-page: https://github.com/python-kasa/python-kasa
6
- License: GPL-3.0-or-later
3
+ Version: 0.7.4
4
+ Summary: Python API for TP-Link Kasa and Tapo devices
5
+ Project-URL: Homepage, https://github.com/python-kasa/python-kasa
6
+ Project-URL: Bug Tracker, https://github.com/python-kasa/python-kasa/issues
7
+ Project-URL: Documentation, https://python-kasa.readthedocs.io
8
+ Project-URL: Repository, https://github.com/python-kasa/python-kasa
7
9
  Author: python-kasa developers
8
- Requires-Python: >=3.9,<4.0
10
+ License: GPL-3.0-or-later
11
+ License-File: LICENSE
9
12
  Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
13
+ Classifier: Operating System :: OS Independent
10
14
  Classifier: Programming Language :: Python :: 3
11
15
  Classifier: Programming Language :: Python :: 3.9
12
16
  Classifier: Programming Language :: Python :: 3.10
13
17
  Classifier: Programming Language :: Python :: 3.11
14
18
  Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Requires-Python: <4.0,>=3.9
21
+ Requires-Dist: aiohttp>=3
22
+ Requires-Dist: async-timeout>=3.0.0
23
+ Requires-Dist: asyncclick>=8.1.7
24
+ Requires-Dist: cryptography>=1.9
25
+ Requires-Dist: pydantic>=1.10.15
26
+ Requires-Dist: typing-extensions<5.0,>=4.12.2
15
27
  Provides-Extra: docs
28
+ Requires-Dist: docutils>=0.17; extra == 'docs'
29
+ Requires-Dist: myst-parser; extra == 'docs'
30
+ Requires-Dist: sphinx-rtd-theme~=2.0; extra == 'docs'
31
+ Requires-Dist: sphinxcontrib-programoutput~=0.0; extra == 'docs'
32
+ Requires-Dist: sphinx~=5.0; extra == 'docs'
16
33
  Provides-Extra: shell
34
+ Requires-Dist: ptpython; extra == 'shell'
35
+ Requires-Dist: rich; extra == 'shell'
17
36
  Provides-Extra: speedups
18
- Requires-Dist: aiohttp (>=3)
19
- Requires-Dist: async-timeout (>=3.0.0)
20
- Requires-Dist: asyncclick (>=8.1.7)
21
- Requires-Dist: cryptography (>=1.9)
22
- Requires-Dist: docutils (>=0.17) ; extra == "docs"
23
- Requires-Dist: kasa-crypt (>=0.2.0) ; extra == "speedups"
24
- Requires-Dist: myst-parser ; extra == "docs"
25
- Requires-Dist: orjson (>=3.9.1) ; extra == "speedups"
26
- Requires-Dist: ptpython ; extra == "shell"
27
- Requires-Dist: pydantic (>=1.10.15)
28
- Requires-Dist: rich ; extra == "shell"
29
- Requires-Dist: sphinx (>=5,<6) ; extra == "docs"
30
- Requires-Dist: sphinx_rtd_theme (>=2,<3) ; extra == "docs"
31
- Requires-Dist: sphinxcontrib-programoutput (>=0,<1) ; extra == "docs"
32
- Requires-Dist: typing-extensions (>=4.12.2,<5.0)
33
- Project-URL: Bug Tracker, https://github.com/python-kasa/python-kasa/issues
34
- Project-URL: Documentation, https://python-kasa.readthedocs.io
35
- Project-URL: Repository, https://github.com/python-kasa/python-kasa
37
+ Requires-Dist: kasa-crypt>=0.2.0; extra == 'speedups'
38
+ Requires-Dist: orjson>=3.9.1; extra == 'speedups'
36
39
  Description-Content-Type: text/markdown
37
40
 
38
41
  # python-kasa
@@ -57,11 +60,12 @@ You can install the most recent release using pip:
57
60
  pip install python-kasa
58
61
  ```
59
62
 
60
- Alternatively, you can clone this repository and use poetry to install the development version:
63
+ Alternatively, you can clone this repository and use `uv` to install the development version:
61
64
  ```
62
65
  git clone https://github.com/python-kasa/python-kasa.git
63
66
  cd python-kasa/
64
- poetry install
67
+ uv sync --all-extras
68
+ uv run kasa
65
69
  ```
66
70
 
67
71
  If you have not yet provisioned your device, [you can do so using the cli tool](https://python-kasa.readthedocs.io/en/latest/cli.html#provisioning).
@@ -264,4 +268,3 @@ See [supported devices in our documentation](SUPPORTED.md) for more detailed inf
264
268
  * [plugp100, another tapo library](https://github.com/petretiandrea/plugp100)
265
269
  * [Home Assistant integration](https://github.com/petretiandrea/home-assistant-tapo-p100)
266
270
  * [rust and python implementation for tapo devices](https://github.com/mihai-dinculescu/tapo/)
267
-
@@ -0,0 +1,104 @@
1
+ kasa/__init__.py,sha256=Hxo9ItTa2noIYRXWVSneK15nDUWdd3fBUcYYJTlC2bM,4454
2
+ kasa/aestransport.py,sha256=Cin2Zz_XUi5N9r8YLmqchkYnLU6ZHHIAg4tIQjPO43A,17128
3
+ kasa/credentials.py,sha256=SU9O5QjkWsozC7oCMhc2abydmETNjLZrJwv_KJ6fnK4,357
4
+ kasa/device.py,sha256=r2Zr18nVDDaLlV6x5lhfqakG_EFUSMPsWZ068BCjiwg,17862
5
+ kasa/device_factory.py,sha256=2o9galcsQOajt8H4zdii1Ads4lgdhQQHAQlwCy-LsIk,7043
6
+ kasa/device_type.py,sha256=MJW1bVoAcH_MILSW8IBpv3jKRbPWkxmvuWdU-7Ov_D0,744
7
+ kasa/deviceconfig.py,sha256=pqAxoA41pIG9Q0E3jdlQKsbPd1Qvc8AScULjaZXxInc,8196
8
+ kasa/discover.py,sha256=i29XbjJ9IVyxNLXmQdXPEMIajpWb3euFGoplSLGr7NY,23650
9
+ kasa/emeterstatus.py,sha256=0EF5XwicsKPKTu6NV80Bs904yOGrCij_3SxsmjpVQrk,2530
10
+ kasa/exceptions.py,sha256=Wek1F49MNEsw9xBS7tpzHi92ZeECM7sI_V13RoQ4UoI,4237
11
+ kasa/feature.py,sha256=ejhoowq4oPIKC29VRoQYhUZwGqUuJro8Bi7GuLl9WMw,10549
12
+ kasa/httpclient.py,sha256=5Tiu6moDHkQWqIAr4w9HdwWmuEuxftDmMXzKe1yj_uc,5631
13
+ kasa/iotprotocol.py,sha256=uj5chjjbPYAVFn3gNSHYIG74qxqzsovsmkRYEHunczY,5566
14
+ kasa/json.py,sha256=cPLAwsWD1yCp3_dHe4CjgrM29FaICHbqUL37QYoiipk,415
15
+ kasa/klaptransport.py,sha256=PPbf2w1F9tLfiYxcTxqM1WyeDaapo2ZkNp1_b0FeyTA,18564
16
+ kasa/module.py,sha256=-Zy0zZV6VfpFtTsSa90L8vUHHUowmZrGP9jQ7iLTwcw,6758
17
+ kasa/modulemapping.py,sha256=79mtaewNYvhFjn1Jo39xE57aid5gn08A-45bOS0vgMs,499
18
+ kasa/modulemapping.pyi,sha256=dP-zCo8FiFOC68TtpBlxDcJASDwUur1gFyC9Ei9aaMU,3853
19
+ kasa/protocol.py,sha256=0d3xfO_vGffOllvGu8lU3ZPyqPQ8hCv4RxOnVWjsPhM,4663
20
+ kasa/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
21
+ kasa/smartprotocol.py,sha256=J6lDJzzaHHPMW-KTTPBwdGpSbboFy1Vt4T7lnaQS7jk,16246
22
+ kasa/xortransport.py,sha256=sXZ6AhCsvmahSIszzDEuv2KXUoPAYBTLQ60e43cSg7k,8428
23
+ kasa/cli/__init__.py,sha256=S8z6xs4EPXXtF2wLwuvDLjcuy46c0jWaG0wiqqU5FiY,27
24
+ kasa/cli/__main__.py,sha256=B5nsKIZhYL1upQHrrKXnqE3t261v8nthD52e8m3DAgY,88
25
+ kasa/cli/common.py,sha256=ETCuAaPyxJaGQXgpVDjt-9g7kIJZjtk-YXLdw9yjFB0,7360
26
+ kasa/cli/device.py,sha256=PLCi3Cwyy6soneJTli_bakz3kI2It4KAg2MA5LViyFQ,5291
27
+ kasa/cli/discover.py,sha256=3FF_CsfbTsd8zsNidOCTDLbHLfVnrc0Fae3FSpPiag4,4742
28
+ kasa/cli/feature.py,sha256=3cm33EuTHDwGX4AX9rZHCIp0J2YHowWeE6O3Rg9EQ0w,3486
29
+ kasa/cli/lazygroup.py,sha256=KBm-21HwxiOnO8houCTBGkPjQiW3cwoCm4DlvJyGzI0,2486
30
+ kasa/cli/light.py,sha256=7Xqid5SfsKg0kK2OCd9winnynt1umw5xgx8Z6ey-s2s,6391
31
+ kasa/cli/main.py,sha256=RiwUd_A5XIun6NY1LlqDIHU_ZPYgo9ukcKPV4WIgaNQ,10776
32
+ kasa/cli/schedule.py,sha256=9WXLPOVZn2p83VxYxnQ4iL5u13VHlYhVaueC08sCO50,1097
33
+ kasa/cli/time.py,sha256=67gPE341LUjxbxrljiEBFiNMjI4kyNyUGKWoxEzT6cw,1201
34
+ kasa/cli/usage.py,sha256=hERbKxCSuSaazkdfkosTAcFcTrpQ2AWJXzdYr-R4pOY,4227
35
+ kasa/cli/wifi.py,sha256=9sJWL7yvOhN-WQm43VWrm85NfsF_jST3t9nILHHXDFo,1100
36
+ kasa/interfaces/__init__.py,sha256=ol9ejrJp35NI1EiMvoZyp7jjYsYMr316goEndzikp44,331
37
+ kasa/interfaces/energy.py,sha256=50CG9Y-c1O27BxwNX4-utYKLhFnYG31ob3czwMe-4p0,6089
38
+ kasa/interfaces/fan.py,sha256=cnT9HpiJrJ9JSrF4nRzb6Ff8OyC1-ZUzW6aIGXQObWc,411
39
+ kasa/interfaces/led.py,sha256=LJR2IiEhZdrskza9nDLAe5WWgr_JCd3B35jve7q0BI0,950
40
+ kasa/interfaces/light.py,sha256=Jk5ELfLF4DegGRwuUVPevx_EqbfNwvGkoRevR3UlYwo,4712
41
+ kasa/interfaces/lighteffect.py,sha256=r42muGmJdjFKGFjqt6RJZUApfaLddrtkbkX-kD7eHyk,3117
42
+ kasa/interfaces/lightpreset.py,sha256=oDIilwkSV03EJ-TgwblFhKavFh6JzXQ3uBAw2t8lNJo,4070
43
+ kasa/iot/__init__.py,sha256=k0QlxHTzb_btqNIIpUd9ybDo-CjkQLa1DReyAkTfs4I,399
44
+ kasa/iot/effects.py,sha256=au35HDrHso7JRdv9bPSdkepdpR8NbSp-gFGHW2SKZUw,7506
45
+ kasa/iot/iotbulb.py,sha256=_zQbQShjJQZ9SBD5POzir1dNpNPDKzDpqQg72licV58,18475
46
+ kasa/iot/iotdevice.py,sha256=Apsbz5w3f7H2C73UWivIFO3ShBa845U1ofGPktMtuaI,22883
47
+ kasa/iot/iotdimmer.py,sha256=aWHgpw7B8XF_t5s3fOPoAJilV8vpFl2H6kUQIH0Qc4g,7780
48
+ kasa/iot/iotlightstrip.py,sha256=uJ9EeN1qiyTcOKhc2Hwso3_1TQMKg1cv4yIUFYpgX5U,2104
49
+ kasa/iot/iotmodule.py,sha256=M3OHij6gq4J49Ybsd1QUhEn8W-VXxoF6FMkn2IcSyDo,2095
50
+ kasa/iot/iotplug.py,sha256=34PH4V1Dpw6pg8j1mBZxI6nfx-JjwerX-0fprOubkU0,2986
51
+ kasa/iot/iotstrip.py,sha256=BIT1gHJy8P4gpjEMkJtE1kMb36UpWZwAR6tW6LdCV0U,15908
52
+ kasa/iot/modules/__init__.py,sha256=Nq49DvOol1DcURsL3ZmXRLOmQRAgA7s3yFA9aiKQkss,751
53
+ kasa/iot/modules/ambientlight.py,sha256=ECdRCsC7L1WV3gY-0MTUlo0vzvvqLRsU5_LOX3FyJ-E,2473
54
+ kasa/iot/modules/antitheft.py,sha256=XV5NM_zMLMU50KpR-MCFGx-1S4TxB61jcuOh3KZ-9Zc,235
55
+ kasa/iot/modules/cloud.py,sha256=CWL54K3iC7VQ7NBdnX039fz6r-MjCwxdhOGqv2QCk7c,2037
56
+ kasa/iot/modules/countdown.py,sha256=53PUMGv3L1zMTkx1PBRvMSGzqX6ZnbwmtXHMyBioT4o,159
57
+ kasa/iot/modules/emeter.py,sha256=vv9jiDTD8oxB_vgXPSSB0RMe65Y0xGm-0Dy7mqqv2II,5025
58
+ kasa/iot/modules/led.py,sha256=J0utBGM7kttH6Llv9TN-W264ttAGp2dx3duJRNSVejc,971
59
+ kasa/iot/modules/light.py,sha256=n5hdgn6IOTe3uhAb4suIjEQwkxmsQsvrbqqM8j7VQZ8,9619
60
+ kasa/iot/modules/lighteffect.py,sha256=nz4fUnJ_4j2hrzF5r8ZP0gOwYgSry2g283Y1IXEs2kU,4199
61
+ kasa/iot/modules/lightpreset.py,sha256=2FNUrrbHhBzXrJH3AlI66OTrXgKwrjkSc2NN8xyPZmI,5559
62
+ kasa/iot/modules/motion.py,sha256=lfxM0CFGacjZrBh6UqN5Kyja4beXwrTNxZUU4lh0xZg,2264
63
+ kasa/iot/modules/rulemodule.py,sha256=_QgsgMRvnh2M2xLx0ACvPdhn_3LZ9zwTbhpT5oQqxvE,2040
64
+ kasa/iot/modules/schedule.py,sha256=r9MbXp4CRV8qKPlSXWY5RpHqkT6ULdLGLg8P857sEqI,151
65
+ kasa/iot/modules/time.py,sha256=4cuogMUfHEcbQ3kCVKuD1Ms2qviU0sXK5yQhaYW_Jpg,1415
66
+ kasa/iot/modules/usage.py,sha256=YeeUdVJ6Koj2eSQ0U9qETdqhBrUVd0j7cnY1XOhVSlc,3819
67
+ kasa/smart/__init__.py,sha256=gdmi-Doe7dnv7e8ab_892lr9IdOXeFa3XlU3u_CePCk,198
68
+ kasa/smart/effects.py,sha256=E3oPHeWlc4lzThBbYV_UC2q-3EpdRiWf8eZiENMfb4k,11476
69
+ kasa/smart/smartchilddevice.py,sha256=7n3yRqnhAQS3C2TGn2Nzq8HHcxynFdLZOiT_JlQRLA4,3346
70
+ kasa/smart/smartdevice.py,sha256=nfNVLK3dBR94NgxY7FVd1ComELdKdUqXWjkmYdEGCXo,26617
71
+ kasa/smart/smartmodule.py,sha256=la_JldxPEpAmleL4qjtEJ6QmiEUeLfyS7A353iJGtAc,7046
72
+ kasa/smart/modules/__init__.py,sha256=YcgDqJ1-OxRYW2NlXyfqhYV-kcFkUo6OQ6ppuVrBCj4,1573
73
+ kasa/smart/modules/alarm.py,sha256=y0ebu-fuVELE-lmVNInr24CvI1TtE9289-BZU8blHBc,4387
74
+ kasa/smart/modules/autooff.py,sha256=PksBuMJ-MGeqsiI0ZSQ-192DToKwC86Pu8fI_b6o1nA,3253
75
+ kasa/smart/modules/batterysensor.py,sha256=E0GZM067J_BHd6K8AO4DrUO8ZLZKubiiDZKL2taNNjY,1753
76
+ kasa/smart/modules/brightness.py,sha256=aP6i-y812eQ4MP-r5LegY1mM1HwYD_37oYJ-ZWQeVZk,2621
77
+ kasa/smart/modules/childdevice.py,sha256=oxzSEk0uDcxtsTfT0TPPb0otPb9fwKpFObihNVheL64,991
78
+ kasa/smart/modules/cloud.py,sha256=sLmckPs1XW4dLPOXAD5bIoJg6lnWDxvoeG7OVNoiBxo,1133
79
+ kasa/smart/modules/color.py,sha256=a0tKJ8QsnSRVFmYX76pHHJARGIuuLG9WK2yvoC2TI0g,3154
80
+ kasa/smart/modules/colortemperature.py,sha256=qeX9Pf3jydNp1-6KiDAEa-YPXdbrTt22_Rpoz3wMOkw,2506
81
+ kasa/smart/modules/contactsensor.py,sha256=wnKkb5yt7OPvdvfFjYlB0_xKsTptviNSQD19UDJQ3sY,1145
82
+ kasa/smart/modules/devicemodule.py,sha256=3SixQV2wXLf14Z3ZA4poHY93pnWK4XHvmHPLkUfOXWw,780
83
+ kasa/smart/modules/energy.py,sha256=-GffhX5hgpfuQczZfWyUTDGmCpV2Mi4bthubqdjsXp8,3391
84
+ kasa/smart/modules/fan.py,sha256=7Vx3o_bKPQxW9FNWN0otX3-80YTwy_-mvttupD1EeXs,2531
85
+ kasa/smart/modules/firmware.py,sha256=SAOtOKg6tlG-Br-TDcP5uRMm_AjTQWeyJ_LlPQKD44I,8534
86
+ kasa/smart/modules/frostprotection.py,sha256=NsNhbvMnuCoUJWGbAWfP7_ODoOiIGISTHHE-Xj9IeNw,1125
87
+ kasa/smart/modules/humiditysensor.py,sha256=tx_LTkk3cEW5DPxrRpSysvCY-XfG7wJ395zTtj6j2hs,1770
88
+ kasa/smart/modules/led.py,sha256=iOx8SJkOECyZ_C2j7bJRHsHHP8LCq6Izvyk0jIqUgrg,1503
89
+ kasa/smart/modules/light.py,sha256=myZ6OeXYquLGBtkw7r66ThcPTiclTIsO5YZJr9O8KMA,5713
90
+ kasa/smart/modules/lighteffect.py,sha256=etR3XLBRP6IbzIO7m7PfHxvdLDL8FIfiWQjfOlv48Ro,6291
91
+ kasa/smart/modules/lightpreset.py,sha256=BSFcopPABaHLF1CERQxe6LkhSdnXSfO6MIINXFHLjK4,6497
92
+ kasa/smart/modules/lightstripeffect.py,sha256=0sPh2xjiS9GEnB5jiA0hm2nF9rzcub4ccwo18MfIt68,6026
93
+ kasa/smart/modules/lighttransition.py,sha256=jcuPQnuBylqQwJlA2gZwKW-ToD1cJoGL3X_WNTSz5Cw,8368
94
+ kasa/smart/modules/motionsensor.py,sha256=55Qoi8Is3VUJDpyzzD_YBcuup_ZTl_RjsjBn2gLASbg,1012
95
+ kasa/smart/modules/reportmode.py,sha256=OZF30Xqlvm6Qo6Fj0IGZdC_dpeTg4r9jYY5IOlUsoeA,1147
96
+ kasa/smart/modules/temperaturecontrol.py,sha256=yE8Y3r2eJAXfPhBzDxvKpr-O7hWUD00L9_rP162VhAg,5801
97
+ kasa/smart/modules/temperaturesensor.py,sha256=MFF_27r1ryxQUit2avKo6pZfhuzWSrTVKYqMZgyOVv8,2734
98
+ kasa/smart/modules/time.py,sha256=CITnlRTe0z48DL2KHu18UDeGLKCy629eghYPq3MOHo8,1891
99
+ kasa/smart/modules/waterleaksensor.py,sha256=yoQtSjM1MO9sMpU2ldtWzHcTPPd7okZNWvjSXmkb4h0,1880
100
+ python_kasa-0.7.4.dist-info/METADATA,sha256=layrDibH3At3DPU6_87rd0pWb4CQJYKaakUODg9kV7Y,11682
101
+ python_kasa-0.7.4.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
102
+ python_kasa-0.7.4.dist-info/entry_points.txt,sha256=gTVS_oUcmt4q77WSkppQofMelqufh0zeXvvUkmBPRJA,47
103
+ python_kasa-0.7.4.dist-info/licenses/LICENSE,sha256=Klt9aEsei738epLgYqeikhpdBWwMvU1VAli14Bxlc5c,33218
104
+ python_kasa-0.7.4.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.9.0
2
+ Generator: hatchling 1.25.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ kasa = kasa.cli.__main__:cli
kasa/tests/__init__.py DELETED
File without changes
kasa/tests/conftest.py DELETED
@@ -1,107 +0,0 @@
1
- from __future__ import annotations
2
-
3
- import warnings
4
- from unittest.mock import MagicMock, patch
5
-
6
- import pytest
7
-
8
- from kasa import (
9
- DeviceConfig,
10
- SmartProtocol,
11
- )
12
- from kasa.protocol import BaseTransport
13
-
14
- from .device_fixtures import * # noqa: F403
15
- from .discovery_fixtures import * # noqa: F403
16
-
17
- # Parametrize tests to run with device both on and off
18
- turn_on = pytest.mark.parametrize("turn_on", [True, False])
19
-
20
-
21
- async def handle_turn_on(dev, turn_on):
22
- if turn_on:
23
- await dev.turn_on()
24
- else:
25
- await dev.turn_off()
26
-
27
-
28
- @pytest.fixture()
29
- def dummy_protocol():
30
- """Return a smart protocol instance with a mocking-ready dummy transport."""
31
-
32
- class DummyTransport(BaseTransport):
33
- @property
34
- def default_port(self) -> int:
35
- return -1
36
-
37
- @property
38
- def credentials_hash(self) -> str:
39
- return "dummy hash"
40
-
41
- async def send(self, request: str) -> dict:
42
- return {}
43
-
44
- async def close(self) -> None:
45
- pass
46
-
47
- async def reset(self) -> None:
48
- pass
49
-
50
- transport = DummyTransport(config=DeviceConfig(host="127.0.0.123"))
51
- protocol = SmartProtocol(transport=transport)
52
- with patch.object(protocol, "BACKOFF_SECONDS_AFTER_TIMEOUT", 0):
53
- yield protocol
54
-
55
-
56
- def pytest_configure():
57
- pytest.fixtures_missing_methods = {}
58
-
59
-
60
- def pytest_sessionfinish(session, exitstatus):
61
- if not pytest.fixtures_missing_methods:
62
- return
63
- msg = "\n"
64
- for fixture, methods in sorted(pytest.fixtures_missing_methods.items()):
65
- method_list = ", ".join(methods)
66
- msg += f"Fixture {fixture} missing: {method_list}\n"
67
-
68
- warnings.warn(
69
- UserWarning(msg),
70
- stacklevel=1,
71
- )
72
-
73
-
74
- def pytest_addoption(parser):
75
- parser.addoption(
76
- "--ip", action="store", default=None, help="run against device on given ip"
77
- )
78
- parser.addoption(
79
- "--username", action="store", default=None, help="authentication username"
80
- )
81
- parser.addoption(
82
- "--password", action="store", default=None, help="authentication password"
83
- )
84
-
85
-
86
- def pytest_collection_modifyitems(config, items):
87
- if not config.getoption("--ip"):
88
- print("Testing against fixtures.")
89
- else:
90
- print("Running against ip %s" % config.getoption("--ip"))
91
- requires_dummy = pytest.mark.skip(
92
- reason="test requires to be run against dummy data"
93
- )
94
- for item in items:
95
- if "requires_dummy" in item.keywords:
96
- item.add_marker(requires_dummy)
97
-
98
-
99
- # allow mocks to be awaited
100
- # https://stackoverflow.com/questions/51394411/python-object-magicmock-cant-be-used-in-await-expression/51399767#51399767
101
-
102
-
103
- async def async_magic():
104
- pass
105
-
106
-
107
- MagicMock.__await__ = lambda x: async_magic().__await__()