myvsb-developer-api 1.0.1__tar.gz → 1.0.2__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 (28) hide show
  1. {myvsb_developer_api-1.0.1/src/myvsb_developer_api.egg-info → myvsb_developer_api-1.0.2}/PKG-INFO +1 -1
  2. {myvsb_developer_api-1.0.1 → myvsb_developer_api-1.0.2}/pyproject.toml +1 -1
  3. {myvsb_developer_api-1.0.1 → myvsb_developer_api-1.0.2}/src/myskoda_openapi/api_layer/exceptions.py +6 -2
  4. {myvsb_developer_api-1.0.1 → myvsb_developer_api-1.0.2}/src/myskoda_openapi/api_layer/rest_api.py +15 -4
  5. {myvsb_developer_api-1.0.1 → myvsb_developer_api-1.0.2/src/myvsb_developer_api.egg-info}/PKG-INFO +1 -1
  6. {myvsb_developer_api-1.0.1 → myvsb_developer_api-1.0.2}/LICENSE +0 -0
  7. {myvsb_developer_api-1.0.1 → myvsb_developer_api-1.0.2}/README.md +0 -0
  8. {myvsb_developer_api-1.0.1 → myvsb_developer_api-1.0.2}/setup.cfg +0 -0
  9. {myvsb_developer_api-1.0.1 → myvsb_developer_api-1.0.2}/src/myskoda_openapi/api_layer/const.py +0 -0
  10. {myvsb_developer_api-1.0.1 → myvsb_developer_api-1.0.2}/src/myskoda_openapi/api_layer/open_api_client.py +0 -0
  11. {myvsb_developer_api-1.0.1 → myvsb_developer_api-1.0.2}/src/myskoda_openapi/api_layer/utils.py +0 -0
  12. {myvsb_developer_api-1.0.1 → myvsb_developer_api-1.0.2}/src/myskoda_openapi/models/active_ventilation.py +0 -0
  13. {myvsb_developer_api-1.0.1 → myvsb_developer_api-1.0.2}/src/myskoda_openapi/models/air_conditioning.py +0 -0
  14. {myvsb_developer_api-1.0.1 → myvsb_developer_api-1.0.2}/src/myskoda_openapi/models/auxiliary_heating.py +0 -0
  15. {myvsb_developer_api-1.0.1 → myvsb_developer_api-1.0.2}/src/myskoda_openapi/models/base_model.py +0 -0
  16. {myvsb_developer_api-1.0.1 → myvsb_developer_api-1.0.2}/src/myskoda_openapi/models/charging.py +0 -0
  17. {myvsb_developer_api-1.0.1 → myvsb_developer_api-1.0.2}/src/myskoda_openapi/models/charging_profiles.py +0 -0
  18. {myvsb_developer_api-1.0.1 → myvsb_developer_api-1.0.2}/src/myskoda_openapi/models/common.py +0 -0
  19. {myvsb_developer_api-1.0.1 → myvsb_developer_api-1.0.2}/src/myskoda_openapi/models/configurations.py +0 -0
  20. {myvsb_developer_api-1.0.1 → myvsb_developer_api-1.0.2}/src/myskoda_openapi/models/driving_range.py +0 -0
  21. {myvsb_developer_api-1.0.1 → myvsb_developer_api-1.0.2}/src/myskoda_openapi/models/enums.py +0 -0
  22. {myvsb_developer_api-1.0.1 → myvsb_developer_api-1.0.2}/src/myskoda_openapi/models/parking_position.py +0 -0
  23. {myvsb_developer_api-1.0.1 → myvsb_developer_api-1.0.2}/src/myskoda_openapi/models/vehicle.py +0 -0
  24. {myvsb_developer_api-1.0.1 → myvsb_developer_api-1.0.2}/src/myskoda_openapi/models/vehicle_status.py +0 -0
  25. {myvsb_developer_api-1.0.1 → myvsb_developer_api-1.0.2}/src/myvsb_developer_api.egg-info/SOURCES.txt +0 -0
  26. {myvsb_developer_api-1.0.1 → myvsb_developer_api-1.0.2}/src/myvsb_developer_api.egg-info/dependency_links.txt +0 -0
  27. {myvsb_developer_api-1.0.1 → myvsb_developer_api-1.0.2}/src/myvsb_developer_api.egg-info/requires.txt +0 -0
  28. {myvsb_developer_api-1.0.1 → myvsb_developer_api-1.0.2}/src/myvsb_developer_api.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: myvsb-developer-api
3
- Version: 1.0.1
3
+ Version: 1.0.2
4
4
  Summary: Asynchronous Python library for the MyVSB Developer API
5
5
  Author-email: net0045 <stepan.netolicky@vsb.cz>
6
6
  Project-URL: Homepage, https://github.com/mobility-lab-vsb/myvsb-developer-api
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "myvsb-developer-api"
7
- version = "1.0.1"
7
+ version = "1.0.2"
8
8
  authors = [
9
9
  { name="net0045", email="stepan.netolicky@vsb.cz" },
10
10
  ]
@@ -25,6 +25,10 @@ class OpenApiVehicleNotFoundError(OpenApiError):
25
25
  def __init__(self, message: str = "Vehicle with this VIN does not exist.") -> None:
26
26
  super().__init__(message, status_code=404)
27
27
 
28
+ class OpenApiUnsupportedError(OpenApiError):
29
+ """Error 422 - Unsupported operation."""
30
+ def __init__(self, message: str = "Vehicle does not support this operation") -> None:
31
+ super().__init__(message, status_code=422)
28
32
 
29
33
  class OpenApiRateLimitError(OpenApiError):
30
34
  """Error 429 - Rate limit exceeded or weak 12V battery."""
@@ -32,6 +36,6 @@ class OpenApiRateLimitError(OpenApiError):
32
36
  super().__init__(message, status_code=429)
33
37
 
34
38
  class OpenApiServerError(OpenApiError):
35
- """Error 500 / 504 - Server error or timeout."""
39
+ """Error 500 - Server error or timeout."""
36
40
  def __init__(self, message: str, status_code: int = 500) -> None:
37
- super().__init__(message, status_code=status_code)
41
+ super().__init__(message, status_code=status_code)
@@ -18,9 +18,11 @@ from ..models.configurations import StartAirConditioningConfiguration, StartAuxi
18
18
  from .exceptions import (
19
19
  OpenApiError,
20
20
  OpenApiAuthenticationError,
21
+ OpenApiUnsupportedError,
21
22
  OpenApiForbiddenError,
22
23
  OpenApiVehicleNotFoundError,
23
24
  OpenApiRateLimitError,
25
+ OpenApiServerError
24
26
  )
25
27
 
26
28
  T = TypeVar("T")
@@ -66,8 +68,12 @@ class SkodaRestAPI:
66
68
  case 401: raise OpenApiAuthenticationError("Invalid or expired X-API-Key.")
67
69
  case 403: raise OpenApiForbiddenError("Access forbidden. User not allowed to execute operation.")
68
70
  case 404: raise OpenApiVehicleNotFoundError("Vehicle with this VIN does not exist.")
71
+ case 422: raise OpenApiUnsupportedError("Vehicle does not support this operation")
69
72
  case 429: raise OpenApiRateLimitError("Rate limit exceeded or insufficient battery level.")
70
73
  case 400: raise OpenApiError("Bad request (e.g. validation or VIN issues).")
74
+ case 500: raise OpenApiServerError("An unexpected error occurred while processing the request.", 500)
75
+ case 503: raise OpenApiServerError("API key validation is temporarily unavailable. Retry after 10 seconds.", 503)
76
+ case 504: raise OpenApiServerError("The vehicle did not respond in time.", 504)
71
77
 
72
78
  return response.status
73
79
  except Exception as err:
@@ -87,10 +93,15 @@ class SkodaRestAPI:
87
93
  async with self._session.get(full_url, headers=headers, params=params) as response:
88
94
  if response.status not in (200, 202):
89
95
  match response.status:
90
- case 401: raise OpenApiAuthenticationError("Invalid or expired X-API-Key.")
91
- case 403: raise OpenApiForbiddenError("Access to the requested resource is forbidden.")
92
- case 404: raise OpenApiVehicleNotFoundError("Vehicle with this VIN does not exist.")
93
- case 429: raise OpenApiRateLimitError("Rate limit exceeded or weak 12V battery.")
96
+ case 401: raise OpenApiAuthenticationError("Invalid or expired X-API-Key.")
97
+ case 403: raise OpenApiForbiddenError("Access forbidden. User not allowed to execute operation.")
98
+ case 404: raise OpenApiVehicleNotFoundError("Vehicle with this VIN does not exist.")
99
+ case 422: raise OpenApiUnsupportedError("Vehicle does not support this operation")
100
+ case 429: raise OpenApiRateLimitError("Rate limit exceeded or insufficient battery level.")
101
+ case 400: raise OpenApiError("Bad request (e.g. validation or VIN issues).")
102
+ case 500: raise OpenApiServerError("An unexpected error occurred while processing the request.", 500)
103
+ case 503: raise OpenApiServerError("API key validation is temporarily unavailable. Retry after 10 seconds.", 503)
104
+ case 504: raise OpenApiServerError("The vehicle did not respond in time.", 504)
94
105
  return await response.json()
95
106
  except Exception as err:
96
107
  raise OpenApiError(f"There has been an error when trying to make the request: {err}") from err
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: myvsb-developer-api
3
- Version: 1.0.1
3
+ Version: 1.0.2
4
4
  Summary: Asynchronous Python library for the MyVSB Developer API
5
5
  Author-email: net0045 <stepan.netolicky@vsb.cz>
6
6
  Project-URL: Homepage, https://github.com/mobility-lab-vsb/myvsb-developer-api