carconnectivity-connector-seatcupra 0.1__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.
- carconnectivity_connector_seatcupra-0.1.dist-info/LICENSE +21 -0
- carconnectivity_connector_seatcupra-0.1.dist-info/METADATA +127 -0
- carconnectivity_connector_seatcupra-0.1.dist-info/RECORD +21 -0
- carconnectivity_connector_seatcupra-0.1.dist-info/WHEEL +5 -0
- carconnectivity_connector_seatcupra-0.1.dist-info/top_level.txt +1 -0
- carconnectivity_connectors/seatcupra/__init__.py +0 -0
- carconnectivity_connectors/seatcupra/_version.py +21 -0
- carconnectivity_connectors/seatcupra/auth/__init__.py +0 -0
- carconnectivity_connectors/seatcupra/auth/auth_util.py +141 -0
- carconnectivity_connectors/seatcupra/auth/helpers/blacklist_retry.py +29 -0
- carconnectivity_connectors/seatcupra/auth/my_cupra_session.py +275 -0
- carconnectivity_connectors/seatcupra/auth/openid_session.py +440 -0
- carconnectivity_connectors/seatcupra/auth/session_manager.py +154 -0
- carconnectivity_connectors/seatcupra/auth/vw_web_session.py +242 -0
- carconnectivity_connectors/seatcupra/capability.py +138 -0
- carconnectivity_connectors/seatcupra/charging.py +74 -0
- carconnectivity_connectors/seatcupra/climatization.py +39 -0
- carconnectivity_connectors/seatcupra/command_impl.py +74 -0
- carconnectivity_connectors/seatcupra/connector.py +1470 -0
- carconnectivity_connectors/seatcupra/ui/connector_ui.py +39 -0
- carconnectivity_connectors/seatcupra/vehicle.py +83 -0
@@ -0,0 +1,39 @@
|
|
1
|
+
""" User interface for the seatcupra connector in the Car Connectivity application. """
|
2
|
+
from __future__ import annotations
|
3
|
+
from typing import TYPE_CHECKING
|
4
|
+
|
5
|
+
import os
|
6
|
+
|
7
|
+
import flask
|
8
|
+
|
9
|
+
from carconnectivity_connectors.base.ui.connector_ui import BaseConnectorUI
|
10
|
+
|
11
|
+
if TYPE_CHECKING:
|
12
|
+
from typing import Optional, List, Dict, Union, Literal
|
13
|
+
|
14
|
+
from carconnectivity_connectors.base.connector import BaseConnector
|
15
|
+
|
16
|
+
|
17
|
+
class ConnectorUI(BaseConnectorUI):
|
18
|
+
"""
|
19
|
+
A user interface class for the Seat/Cupra connector in the Car Connectivity application.
|
20
|
+
"""
|
21
|
+
def __init__(self, connector: BaseConnector):
|
22
|
+
blueprint: Optional[flask.Blueprint] = flask.Blueprint(name='seatcupra', import_name='carconnectivity-connector-seatcupra', url_prefix='/seatcupra',
|
23
|
+
template_folder=os.path.dirname(__file__) + '/templates')
|
24
|
+
super().__init__(connector, blueprint=blueprint)
|
25
|
+
|
26
|
+
def get_nav_items(self) -> List[Dict[Literal['text', 'url', 'sublinks', 'divider'], Union[str, List]]]:
|
27
|
+
"""
|
28
|
+
Generates a list of navigation items for the Seat/Cupra connector UI.
|
29
|
+
"""
|
30
|
+
return super().get_nav_items()
|
31
|
+
|
32
|
+
def get_title(self) -> str:
|
33
|
+
"""
|
34
|
+
Returns the title of the connector.
|
35
|
+
|
36
|
+
Returns:
|
37
|
+
str: The title of the connector, which is "Seat/Cupra".
|
38
|
+
"""
|
39
|
+
return "Seat/Cupra"
|
@@ -0,0 +1,83 @@
|
|
1
|
+
"""Module for vehicle classes."""
|
2
|
+
from __future__ import annotations
|
3
|
+
from typing import TYPE_CHECKING
|
4
|
+
|
5
|
+
from carconnectivity.vehicle import GenericVehicle, ElectricVehicle, CombustionVehicle, HybridVehicle
|
6
|
+
|
7
|
+
from carconnectivity_connectors.seatcupra.capability import Capabilities
|
8
|
+
from carconnectivity_connectors.seatcupra.climatization import SeatCupraClimatization
|
9
|
+
|
10
|
+
SUPPORT_IMAGES = False
|
11
|
+
try:
|
12
|
+
from PIL import Image
|
13
|
+
SUPPORT_IMAGES = True
|
14
|
+
except ImportError:
|
15
|
+
pass
|
16
|
+
|
17
|
+
if TYPE_CHECKING:
|
18
|
+
from typing import Optional, Dict
|
19
|
+
from carconnectivity.garage import Garage
|
20
|
+
from carconnectivity_connectors.base.connector import BaseConnector
|
21
|
+
|
22
|
+
|
23
|
+
class SeatCupraVehicle(GenericVehicle): # pylint: disable=too-many-instance-attributes
|
24
|
+
"""
|
25
|
+
A class to represent a generic Seat/Cupra vehicle.
|
26
|
+
|
27
|
+
Attributes:
|
28
|
+
-----------
|
29
|
+
vin : StringAttribute
|
30
|
+
The vehicle identification number (VIN) of the vehicle.
|
31
|
+
license_plate : StringAttribute
|
32
|
+
The license plate of the vehicle.
|
33
|
+
"""
|
34
|
+
def __init__(self, vin: Optional[str] = None, garage: Optional[Garage] = None, managing_connector: Optional[BaseConnector] = None,
|
35
|
+
origin: Optional[SeatCupraVehicle] = None) -> None:
|
36
|
+
if origin is not None:
|
37
|
+
super().__init__(origin=origin)
|
38
|
+
self.capabilities: Capabilities = origin.capabilities
|
39
|
+
self.capabilities.parent = self
|
40
|
+
if SUPPORT_IMAGES:
|
41
|
+
self._car_images = origin._car_images
|
42
|
+
else:
|
43
|
+
super().__init__(vin=vin, garage=garage, managing_connector=managing_connector)
|
44
|
+
self.climatization = SeatCupraClimatization(vehicle=self, origin=self.climatization)
|
45
|
+
self.capabilities: Capabilities = Capabilities(vehicle=self)
|
46
|
+
if SUPPORT_IMAGES:
|
47
|
+
self._car_images: Dict[str, Image.Image] = {}
|
48
|
+
|
49
|
+
|
50
|
+
class SeatCupraElectricVehicle(ElectricVehicle, SeatCupraVehicle):
|
51
|
+
"""
|
52
|
+
Represents a Seat/Cupra electric vehicle.
|
53
|
+
"""
|
54
|
+
def __init__(self, vin: Optional[str] = None, garage: Optional[Garage] = None, managing_connector: Optional[BaseConnector] = None,
|
55
|
+
origin: Optional[SeatCupraVehicle] = None) -> None:
|
56
|
+
if origin is not None:
|
57
|
+
super().__init__(origin=origin)
|
58
|
+
else:
|
59
|
+
super().__init__(vin=vin, garage=garage, managing_connector=managing_connector)
|
60
|
+
|
61
|
+
|
62
|
+
class SeatCupraCombustionVehicle(CombustionVehicle, SeatCupraVehicle):
|
63
|
+
"""
|
64
|
+
Represents a Seat/Cupra combustion vehicle.
|
65
|
+
"""
|
66
|
+
def __init__(self, vin: Optional[str] = None, garage: Optional[Garage] = None, managing_connector: Optional[BaseConnector] = None,
|
67
|
+
origin: Optional[SeatCupraVehicle] = None) -> None:
|
68
|
+
if origin is not None:
|
69
|
+
super().__init__(origin=origin)
|
70
|
+
else:
|
71
|
+
super().__init__(vin=vin, garage=garage, managing_connector=managing_connector)
|
72
|
+
|
73
|
+
|
74
|
+
class SeatCupraHybridVehicle(HybridVehicle, SeatCupraVehicle):
|
75
|
+
"""
|
76
|
+
Represents a Seat/Cupra hybrid vehicle.
|
77
|
+
"""
|
78
|
+
def __init__(self, vin: Optional[str] = None, garage: Optional[Garage] = None, managing_connector: Optional[BaseConnector] = None,
|
79
|
+
origin: Optional[SeatCupraVehicle] = None) -> None:
|
80
|
+
if origin is not None:
|
81
|
+
super().__init__(origin=origin)
|
82
|
+
else:
|
83
|
+
super().__init__(vin=vin, garage=garage, managing_connector=managing_connector)
|