pymammotion 0.5.41__py3-none-any.whl → 0.5.42__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.

Potentially problematic release.


This version of pymammotion might be problematic. Click here for more details.

pymammotion/http/http.py CHANGED
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  import csv
2
4
  import random
3
5
  import time
@@ -33,7 +35,7 @@ class MammotionHTTP:
33
35
  self.msg = None
34
36
  self.account = account
35
37
  self._password = password
36
- self.response: Response | None = None
38
+ self._response: Response | None = None
37
39
  self.login_info: LoginResponseData | None = None
38
40
  self.jwt_info: JWTTokenInfo = JWTTokenInfo("", "")
39
41
  self._headers = {"User-Agent": "okhttp/4.9.3", "App-Version": "Home Assistant,1.14.2.29"}
@@ -47,6 +49,17 @@ class MammotionHTTP:
47
49
  # Replace the line in the __init__ method with:
48
50
  self.client_id = f"{int(time.time() * 1000)}_{get_10_random()}_1"
49
51
 
52
+ @property
53
+ def response(self) -> Response | None:
54
+ return self._response
55
+
56
+ @response.setter
57
+ def response(self, response: Response) -> None:
58
+ self._response = response
59
+ decoded_token = jwt.decode(response.data.access_token, options={"verify_signature": False})
60
+ if isinstance(decoded_token, dict):
61
+ self.jwt_info = JWTTokenInfo(iot=decoded_token.get("iot", ""), robot=decoded_token.get("robot", ""))
62
+
50
63
  @staticmethod
51
64
  def generate_headers(token: str) -> dict:
52
65
  return {"Authorization": f"Bearer {token}"}
@@ -416,9 +429,6 @@ class MammotionHTTP:
416
429
  self.response = login_response
417
430
  self.msg = login_response.msg
418
431
  self.code = login_response.code
419
- decoded_token = jwt.decode(self.response.data.access_token, options={"verify_signature": False})
420
- if isinstance(decoded_token, dict):
421
- self.jwt_info = JWTTokenInfo(iot=decoded_token.get("iot", ""), robot=decoded_token.get("robot", ""))
422
432
  # TODO catch errors from mismatch user / password elsewhere
423
433
  # Assuming the data format matches the expected structure
424
434
  return login_response
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pymammotion
3
- Version: 0.5.41
3
+ Version: 0.5.42
4
4
  Author: jLynx
5
5
  Author-email: Michael Arthur <michael@jumblesoft.co.nz>
6
6
  License-Expression: GPL-3.0
@@ -57,7 +57,7 @@ pymammotion/homeassistant/rtk_api.py,sha256=YyTF_14cWvvT31H-LYD715W82KsWfkV1nwXs
57
57
  pymammotion/http/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
58
58
  pymammotion/http/_init_.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
59
59
  pymammotion/http/encryption.py,sha256=lzXu3WwBdQlzjXxWnlJuRgkCrKdPbxx5drhMitVKIEk,8287
60
- pymammotion/http/http.py,sha256=GVCxnAulP-A9BWcjuEGVJdr-kDEPlMF4VyKUoaNwPVg,19967
60
+ pymammotion/http/http.py,sha256=bh1bYM9dJmc8Eh4jJ8J-IOVzJVThehHq633pqaaPv_E,20171
61
61
  pymammotion/http/model/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
62
62
  pymammotion/http/model/camera_stream.py,sha256=ilxQNny_w9Frwt-m8kbHinvyjDv4Bx8C2swfZ2lTEDE,600
63
63
  pymammotion/http/model/http.py,sha256=GyWXIL4fNBssuE7WJR1IR89shWUEMbxRF3T9L24jGMM,6381
@@ -144,7 +144,7 @@ pymammotion/utility/periodic.py,sha256=MbeSb9cfhxzYmdT_RiE0dZe3H9IfbQW_zSqhmSX2R
144
144
  pymammotion/utility/rocker_util.py,sha256=6tX7sS87qoQC_tsxbx3NLL-HgS08wtzXiZkhDiz7uo0,7179
145
145
  pymammotion/utility/constant/__init__.py,sha256=tcY0LDeD-qDDHx2LKt55KOyv9ZI0UfCNM6fknLCmm8s,110
146
146
  pymammotion/utility/constant/device_constant.py,sha256=MJE1DEOg86oWNSXYGx3xxJ542KEuSJNZ0VJLN4eHbUg,8237
147
- pymammotion-0.5.41.dist-info/METADATA,sha256=yN9amR2-8oUx6zF5kIHsRHJCX2YQ93M2BRk4gITYC-o,3575
148
- pymammotion-0.5.41.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
149
- pymammotion-0.5.41.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
150
- pymammotion-0.5.41.dist-info/RECORD,,
147
+ pymammotion-0.5.42.dist-info/METADATA,sha256=Qc1EJVsa848is148yLnj19w84HLUYCm7QF15WURBsHU,3575
148
+ pymammotion-0.5.42.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
149
+ pymammotion-0.5.42.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
150
+ pymammotion-0.5.42.dist-info/RECORD,,