mg-saic-client 0.9.4__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.
Files changed (34) hide show
  1. mg_saic_client-0.9.4/LICENSE +21 -0
  2. mg_saic_client-0.9.4/PKG-INFO +50 -0
  3. mg_saic_client-0.9.4/README.md +30 -0
  4. mg_saic_client-0.9.4/pyproject.toml +231 -0
  5. mg_saic_client-0.9.4/src/saic_ismart_client_ng/__init__.py +21 -0
  6. mg_saic_client-0.9.4/src/saic_ismart_client_ng/api/__init__.py +0 -0
  7. mg_saic_client-0.9.4/src/saic_ismart_client_ng/api/base.py +429 -0
  8. mg_saic_client-0.9.4/src/saic_ismart_client_ng/api/message/__init__.py +87 -0
  9. mg_saic_client-0.9.4/src/saic_ismart_client_ng/api/message/schema.py +82 -0
  10. mg_saic_client-0.9.4/src/saic_ismart_client_ng/api/schema.py +74 -0
  11. mg_saic_client-0.9.4/src/saic_ismart_client_ng/api/serialization_utils.py +17 -0
  12. mg_saic_client-0.9.4/src/saic_ismart_client_ng/api/user/__init__.py +13 -0
  13. mg_saic_client-0.9.4/src/saic_ismart_client_ng/api/user/schema.py +8 -0
  14. mg_saic_client-0.9.4/src/saic_ismart_client_ng/api/vehicle/__init__.py +94 -0
  15. mg_saic_client-0.9.4/src/saic_ismart_client_ng/api/vehicle/alarm/__init__.py +39 -0
  16. mg_saic_client-0.9.4/src/saic_ismart_client_ng/api/vehicle/alarm/schema.py +28 -0
  17. mg_saic_client-0.9.4/src/saic_ismart_client_ng/api/vehicle/climate/__init__.py +107 -0
  18. mg_saic_client-0.9.4/src/saic_ismart_client_ng/api/vehicle/locks/__init__.py +60 -0
  19. mg_saic_client-0.9.4/src/saic_ismart_client_ng/api/vehicle/locks/schema.py +8 -0
  20. mg_saic_client-0.9.4/src/saic_ismart_client_ng/api/vehicle/schema.py +220 -0
  21. mg_saic_client-0.9.4/src/saic_ismart_client_ng/api/vehicle/windows/__init__.py +59 -0
  22. mg_saic_client-0.9.4/src/saic_ismart_client_ng/api/vehicle/windows/schema.py +13 -0
  23. mg_saic_client-0.9.4/src/saic_ismart_client_ng/api/vehicle_charging/__init__.py +256 -0
  24. mg_saic_client-0.9.4/src/saic_ismart_client_ng/api/vehicle_charging/schema.py +614 -0
  25. mg_saic_client-0.9.4/src/saic_ismart_client_ng/crypto_utils.py +94 -0
  26. mg_saic_client-0.9.4/src/saic_ismart_client_ng/exceptions.py +31 -0
  27. mg_saic_client-0.9.4/src/saic_ismart_client_ng/listener.py +13 -0
  28. mg_saic_client-0.9.4/src/saic_ismart_client_ng/model.py +62 -0
  29. mg_saic_client-0.9.4/src/saic_ismart_client_ng/net/__init__.py +1 -0
  30. mg_saic_client-0.9.4/src/saic_ismart_client_ng/net/client/__init__.py +102 -0
  31. mg_saic_client-0.9.4/src/saic_ismart_client_ng/net/crypto.py +240 -0
  32. mg_saic_client-0.9.4/src/saic_ismart_client_ng/net/httpx/__init__.py +81 -0
  33. mg_saic_client-0.9.4/src/saic_ismart_client_ng/net/utils.py +11 -0
  34. mg_saic_client-0.9.4/src/saic_ismart_client_ng/py.typed +0 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 The SAIC-iSmart-API project
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,50 @@
1
+ Metadata-Version: 2.4
2
+ Name: mg-saic-client
3
+ Version: 0.9.4
4
+ Summary: SAIC next gen client library (MG iSMART)
5
+ License-File: LICENSE
6
+ Author: Giovanni Condello
7
+ Author-email: saic-python-client@nanomad.net
8
+ Requires-Python: >=3.11
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Requires-Dist: dacite (>=1.8.1,<2.0.0)
13
+ Requires-Dist: httpx (>=0.27.0,<0.29.0)
14
+ Requires-Dist: pycryptodome (>=3.20.0,<4.0.0)
15
+ Requires-Dist: tenacity (>=9.0.0,<10.0.0)
16
+ Project-URL: Homepage, https://github.com/SAIC-iSmart-API/saic-python-client-ng
17
+ Project-URL: Issues, https://github.com/SAIC-iSmart-API/saic-python-client-ng/issues
18
+ Description-Content-Type: text/markdown
19
+
20
+ # SAIC Python client library
21
+
22
+ ## About
23
+
24
+ A Python package for interacting with the MG iSmart API.
25
+
26
+ MG iSmart is the connectivity system in your MG car (MG5 MG4, ZS, MGS5, MGS6 ...).
27
+
28
+ Supported functionality (partial list, check the code for more)
29
+
30
+ * login
31
+ * set alarm switches
32
+ * get message list
33
+ * get vehicle status
34
+ * get charging status
35
+ * lock vehicle
36
+ * unlock vehicle
37
+ * start rear window heating
38
+ * stop rear window heating
39
+ * remote climate
40
+ * heated seats
41
+
42
+
43
+ ## Prerequisites
44
+
45
+ You have an iSmart account (can be created in the iSmart app)
46
+
47
+ ## Credit
48
+
49
+ This is a maintained fork of [SAIC-iSmart-API/saic-python-client-ng](https://github.com/SAIC-iSmart-API/saic-python-client-ng) by Giovanni Condello, used by the [mg-saic-ha](https://github.com/townsmcp/mg-saic-ha) Home Assistant integration. Licensed under MIT; see [LICENSE](LICENSE).
50
+
@@ -0,0 +1,30 @@
1
+ # SAIC Python client library
2
+
3
+ ## About
4
+
5
+ A Python package for interacting with the MG iSmart API.
6
+
7
+ MG iSmart is the connectivity system in your MG car (MG5 MG4, ZS, MGS5, MGS6 ...).
8
+
9
+ Supported functionality (partial list, check the code for more)
10
+
11
+ * login
12
+ * set alarm switches
13
+ * get message list
14
+ * get vehicle status
15
+ * get charging status
16
+ * lock vehicle
17
+ * unlock vehicle
18
+ * start rear window heating
19
+ * stop rear window heating
20
+ * remote climate
21
+ * heated seats
22
+
23
+
24
+ ## Prerequisites
25
+
26
+ You have an iSmart account (can be created in the iSmart app)
27
+
28
+ ## Credit
29
+
30
+ This is a maintained fork of [SAIC-iSmart-API/saic-python-client-ng](https://github.com/SAIC-iSmart-API/saic-python-client-ng) by Giovanni Condello, used by the [mg-saic-ha](https://github.com/townsmcp/mg-saic-ha) Home Assistant integration. Licensed under MIT; see [LICENSE](LICENSE).
@@ -0,0 +1,231 @@
1
+ [project]
2
+ name = "mg-saic-client"
3
+ version = "0.9.4"
4
+ description = "SAIC next gen client library (MG iSMART)"
5
+ authors = [
6
+ { name = "Giovanni Condello", email = "saic-python-client@nanomad.net" },
7
+ ]
8
+ readme = "README.md"
9
+
10
+ classifiers = [
11
+ "Programming Language :: Python :: 3",
12
+ "License :: OSI Approved :: MIT License",
13
+ "Operating System :: OS Independent",
14
+ ]
15
+
16
+ requires-python = ">=3.11"
17
+
18
+ dependencies = [
19
+ "pycryptodome (>=3.20.0,<4.0.0)",
20
+ "httpx (>=0.27.0,<0.29.0)",
21
+ "tenacity (>=9.0.0,<10.0.0)",
22
+ "dacite (>=1.8.1,<2.0.0)"
23
+ ]
24
+
25
+ [project.urls]
26
+ Homepage = "https://github.com/SAIC-iSmart-API/saic-python-client-ng"
27
+ Issues = "https://github.com/SAIC-iSmart-API/saic-python-client-ng/issues"
28
+
29
+ [build-system]
30
+ requires = ["poetry-core>=2.0.0,<3.0.0"]
31
+ build-backend = "poetry.core.masonry.api"
32
+
33
+ [tool.poetry]
34
+ packages = [{ include = "saic_ismart_client_ng", from = "src" }]
35
+
36
+ [tool.poetry.group.dev.dependencies]
37
+ pytest = "^8.2.2"
38
+ mock = "^5.1.0"
39
+ coverage = "^7.5.4"
40
+ ruff = "^0.12.0"
41
+ pytest-cov = "^5.0.0"
42
+ pytest-asyncio = "^0.24.0"
43
+ pytest-mock = "^3.14.0"
44
+ mypy = "^1.15.0"
45
+ pylint = "^3.3.6"
46
+ pre-commit = "^4.2.0"
47
+
48
+ [tool.pytest.ini_options]
49
+ norecursedirs = ".git build dist"
50
+ testpaths = "tests"
51
+ pythonpath = [
52
+ "src"
53
+ ]
54
+ mock_use_standalone_module = true
55
+ addopts = [
56
+ "--import-mode=importlib",
57
+ ]
58
+ asyncio_default_fixture_loop_scope = "function"
59
+
60
+ [tool.coverage.run]
61
+ omit = [
62
+ "tests/*",
63
+ ]
64
+ branch = true
65
+ command_line = "-m pytest"
66
+
67
+ [tool.coverage.report]
68
+ # Regexes for lines to exclude from consideration
69
+ exclude_lines = [
70
+ # Have to re-enable the standard pragma
71
+ 'pragma: no cover',
72
+ # Don't complain about missing debug-only code:
73
+ 'def __repr__',
74
+ 'if self\.debug',
75
+ # Don't complain if tests don't hit defensive assertion code:
76
+ 'raise AssertionError',
77
+ 'raise NotImplementedError',
78
+ # Don't complain if non-runnable code isn't run:
79
+ 'if 0:',
80
+ 'if __name__ == .__main__.:',
81
+ ]
82
+ ignore_errors = true
83
+
84
+ [tool.ruff]
85
+ include = [
86
+ "src/**/*.py",
87
+ "tests/**/*.py",
88
+ "**/pyproject.toml"
89
+ ]
90
+
91
+ [tool.ruff.lint]
92
+ select = ["ALL"]
93
+
94
+ ignore = [
95
+ "ANN401", # Opinioated warning on disallowing dynamically typed expressions
96
+ "D203", # Conflicts with other rules
97
+ "D213", # Conflicts with other rules
98
+ "EM101", # raw-string-in-exception
99
+
100
+ "D105", # Missing docstring in magic method
101
+ "D107", # Missing docstring in `__init__`
102
+ "E501", # line too long
103
+
104
+ "FBT", # flake8-boolean-trap
105
+
106
+ "PLR2004", # Magic value used in comparison, consider replacing {value} with a constant variable
107
+
108
+ # Used to map JSON responses
109
+ "N815",
110
+ # Conflicts with the Ruff formatter
111
+ "COM812",
112
+ # We use Exception istead of Error
113
+ "N818",
114
+ # Remove later
115
+ "D100", # Missing docstring in public module
116
+ "D101", # Missing docstring in public class
117
+ "D102", # Missing docstring in public method
118
+ "D103", # Missing docstring in public function
119
+ "D104", # Missing docstring in public package
120
+ "D106", # Missing docstring in public nested class
121
+ "TD", # Todos
122
+ "A", # bultins
123
+ "DTZ", # use tz need to test it first
124
+ "TRY", # tryceratops
125
+ "FIX002", # Line contains TODO, consider resolving the issue
126
+ "BLE001", # Do not catch blind exception: `Exception`,
127
+ "PLR0913", # Too many arguments in function definition
128
+ "ERA001" # Commented-out code
129
+
130
+ ]
131
+
132
+ [tool.ruff.lint.flake8-pytest-style]
133
+ fixture-parentheses = false
134
+
135
+ [tool.ruff.lint.isort]
136
+ combine-as-imports = true
137
+ force-sort-within-sections = true
138
+ known-first-party = ["saic_ismart_client_ng"]
139
+ required-imports = ["from __future__ import annotations"]
140
+
141
+
142
+ [tool.ruff.lint.per-file-ignores]
143
+ "tests/**" = [
144
+ "D100", # Missing docstring in public module
145
+ "D103", # Missing docstring in public function
146
+ "D104", # Missing docstring in public package
147
+ "N802", # Function name {name} should be lowercase
148
+ "N816", # Variable {name} in global scope should not be mixedCase
149
+ "S101", # Use of assert detected
150
+ "SLF001", # Private member accessed: {access}
151
+ "T201", # print found
152
+ ]
153
+
154
+ [tool.ruff.lint.mccabe]
155
+ max-complexity = 13
156
+
157
+ [tool.ruff.lint.pylint]
158
+ max-args = 10
159
+
160
+ [tool.mypy]
161
+ files = ["./src", "./tests"]
162
+ python_version = 3.11
163
+ show_error_codes = true
164
+ strict_equality = true
165
+ warn_incomplete_stub = true
166
+ warn_redundant_casts = true
167
+ warn_unused_configs = true
168
+ warn_unused_ignores = true
169
+ check_untyped_defs = true
170
+ disallow_incomplete_defs = true
171
+ disallow_subclassing_any = true
172
+ disallow_untyped_calls = true
173
+ disallow_untyped_decorators = true
174
+ disallow_untyped_defs = true
175
+ no_implicit_optional = true
176
+ warn_return_any = true
177
+ warn_unreachable = true
178
+ strict = true
179
+
180
+ [tool.pylint.MAIN]
181
+ py-version = "3.11"
182
+ ignore = ["tests"]
183
+ fail-on = ["I"]
184
+
185
+ [tool.pylint.BASIC]
186
+ good-names = ["i", "j", "k", "ex", "_", "T", "x", "y", "id", "tg"]
187
+
188
+ [tool.pylint."MESSAGES CONTROL"]
189
+ # Reasons disabled:
190
+ # format - handled by black
191
+ # duplicate-code - unavoidable
192
+ # cyclic-import - doesn't test if both import on load
193
+ # abstract-class-little-used - prevents from setting right foundation
194
+ # too-many-* - are not enforced for the sake of readability
195
+ # too-few-* - same as too-many-*
196
+ # abstract-method - with intro of async there are always methods missing
197
+ # inconsistent-return-statements - doesn't handle raise
198
+ # too-many-ancestors - it's too strict.
199
+ # wrong-import-order - isort guards this
200
+ # ---
201
+ # Pylint CodeStyle plugin
202
+ # consider-using-namedtuple-or-dataclass - too opinionated
203
+ # consider-using-assignment-expr - decision to use := better left to devs
204
+ disable = [
205
+ "format",
206
+ "cyclic-import",
207
+ "duplicate-code",
208
+ "too-many-arguments",
209
+ "too-many-instance-attributes",
210
+ "too-many-locals",
211
+ "too-many-ancestors",
212
+ "too-few-public-methods",
213
+ "invalid-name",
214
+ # Remove later
215
+ "missing-function-docstring",
216
+ "missing-module-docstring",
217
+ "missing-class-docstring",
218
+ "broad-exception-caught",
219
+ "logging-fstring-interpolation",
220
+ "fixme"
221
+ ]
222
+ enable = ["useless-suppression", "use-symbolic-message-instead"]
223
+
224
+ [tool.pylint.REPORTS]
225
+ score = false
226
+
227
+ [tool.pylint.FORMAT]
228
+ expected-line-ending-format = "LF"
229
+
230
+ [tool.pylint.EXCEPTIONS]
231
+ overgeneral-exceptions = ["builtins.BaseException", "builtins.Exception"]
@@ -0,0 +1,21 @@
1
+ from __future__ import annotations
2
+
3
+ from saic_ismart_client_ng.api.message import SaicMessageApi
4
+ from saic_ismart_client_ng.api.user import SaicUserApi
5
+ from saic_ismart_client_ng.api.vehicle.alarm import SaicVehicleAlarmApi
6
+ from saic_ismart_client_ng.api.vehicle.climate import SaicVehicleClimateApi
7
+ from saic_ismart_client_ng.api.vehicle.locks import SaicVehicleLocksApi
8
+ from saic_ismart_client_ng.api.vehicle.windows import SaicVehicleWindowsApi
9
+ from saic_ismart_client_ng.api.vehicle_charging import SaicVehicleChargingApi
10
+
11
+
12
+ class SaicApi(
13
+ SaicUserApi,
14
+ SaicMessageApi,
15
+ SaicVehicleAlarmApi,
16
+ SaicVehicleLocksApi,
17
+ SaicVehicleWindowsApi,
18
+ SaicVehicleClimateApi,
19
+ SaicVehicleChargingApi,
20
+ ):
21
+ """The SAIC Api client."""