tesla-api-sdk 1.0.0__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.
- tesla_api_sdk-1.0.0.dist-info/METADATA +145 -0
- tesla_api_sdk-1.0.0.dist-info/RECORD +119 -0
- tesla_api_sdk-1.0.0.dist-info/WHEEL +5 -0
- tesla_api_sdk-1.0.0.dist-info/licenses/LICENSE +28 -0
- tesla_api_sdk-1.0.0.dist-info/top_level.txt +1 -0
- teslafleetmanagementapi/__init__.py +13 -0
- teslafleetmanagementapi/api_helper.py +19 -0
- teslafleetmanagementapi/configuration.py +270 -0
- teslafleetmanagementapi/controllers/__init__.py +11 -0
- teslafleetmanagementapi/controllers/base_controller.py +70 -0
- teslafleetmanagementapi/controllers/charging_controller.py +140 -0
- teslafleetmanagementapi/controllers/energy_controller.py +572 -0
- teslafleetmanagementapi/controllers/oauth_authorization_controller.py +165 -0
- teslafleetmanagementapi/controllers/partner_controller.py +181 -0
- teslafleetmanagementapi/controllers/user_controller.py +158 -0
- teslafleetmanagementapi/controllers/vehicles_controller.py +832 -0
- teslafleetmanagementapi/exceptions/__init__.py +6 -0
- teslafleetmanagementapi/exceptions/api_exception.py +36 -0
- teslafleetmanagementapi/exceptions/oauth_provider_exception.py +75 -0
- teslafleetmanagementapi/http/__init__.py +11 -0
- teslafleetmanagementapi/http/api_response.py +67 -0
- teslafleetmanagementapi/http/auth/__init__.py +6 -0
- teslafleetmanagementapi/http/auth/bearer_auth.py +103 -0
- teslafleetmanagementapi/http/auth/oauth_2.py +311 -0
- teslafleetmanagementapi/http/http_call_back.py +20 -0
- teslafleetmanagementapi/http/http_client_provider.py +23 -0
- teslafleetmanagementapi/http/http_method_enum.py +25 -0
- teslafleetmanagementapi/http/http_request.py +55 -0
- teslafleetmanagementapi/http/http_response.py +45 -0
- teslafleetmanagementapi/http/proxy_settings.py +50 -0
- teslafleetmanagementapi/logging/__init__.py +6 -0
- teslafleetmanagementapi/logging/configuration/__init__.py +5 -0
- teslafleetmanagementapi/logging/configuration/api_logging_configuration.py +398 -0
- teslafleetmanagementapi/logging/sdk_logger.py +28 -0
- teslafleetmanagementapi/models/__init__.py +85 -0
- teslafleetmanagementapi/models/api_1_dx_vehicles_options_response.py +110 -0
- teslafleetmanagementapi/models/api_1_dx_warranty_details_response.py +110 -0
- teslafleetmanagementapi/models/api_1_vehicles_mobile_enabled_response.py +109 -0
- teslafleetmanagementapi/models/api_1_vehicles_nearby_charging_sites_response.py +109 -0
- teslafleetmanagementapi/models/api_1_vehicles_response.py +162 -0
- teslafleetmanagementapi/models/api_1_vehicles_response_get_vehicle.py +109 -0
- teslafleetmanagementapi/models/api_1_vehicles_wake_up_response.py +109 -0
- teslafleetmanagementapi/models/backup_request.py +92 -0
- teslafleetmanagementapi/models/backup_response.py +95 -0
- teslafleetmanagementapi/models/calendar_history_response.py +96 -0
- teslafleetmanagementapi/models/charge_duration.py +92 -0
- teslafleetmanagementapi/models/charge_history.py +125 -0
- teslafleetmanagementapi/models/charge_history_response.py +96 -0
- teslafleetmanagementapi/models/charge_start_time.py +92 -0
- teslafleetmanagementapi/models/charging_dimension.py +128 -0
- teslafleetmanagementapi/models/charging_fee.py +641 -0
- teslafleetmanagementapi/models/charging_history_data.py +98 -0
- teslafleetmanagementapi/models/charging_history_item.py +336 -0
- teslafleetmanagementapi/models/charging_history_response.py +96 -0
- teslafleetmanagementapi/models/charging_invoice.py +151 -0
- teslafleetmanagementapi/models/charging_location.py +293 -0
- teslafleetmanagementapi/models/charging_period.py +136 -0
- teslafleetmanagementapi/models/charging_session.py +355 -0
- teslafleetmanagementapi/models/charging_sessions_data.py +182 -0
- teslafleetmanagementapi/models/charging_sessions_response.py +96 -0
- teslafleetmanagementapi/models/default_real_mode.py +45 -0
- teslafleetmanagementapi/models/driver.py +289 -0
- teslafleetmanagementapi/models/drivers_response.py +135 -0
- teslafleetmanagementapi/models/enterprise_payer_request.py +141 -0
- teslafleetmanagementapi/models/event.py +107 -0
- teslafleetmanagementapi/models/fleet_status_request.py +105 -0
- teslafleetmanagementapi/models/fleet_telemetry_error.py +118 -0
- teslafleetmanagementapi/models/fleet_telemetry_errors_response.py +96 -0
- teslafleetmanagementapi/models/fleet_telemetry_jws_request.py +128 -0
- teslafleetmanagementapi/models/generic_update_response.py +95 -0
- teslafleetmanagementapi/models/kind.py +45 -0
- teslafleetmanagementapi/models/kind_get_wall_connector_charging_history.py +42 -0
- teslafleetmanagementapi/models/live_status_response.py +96 -0
- teslafleetmanagementapi/models/location.py +128 -0
- teslafleetmanagementapi/models/location_1.py +128 -0
- teslafleetmanagementapi/models/me_response.py +95 -0
- teslafleetmanagementapi/models/mobile_enabled.py +128 -0
- teslafleetmanagementapi/models/oauth_provider_error.py +67 -0
- teslafleetmanagementapi/models/oauth_token.py +115 -0
- teslafleetmanagementapi/models/off_grid_vehicle_charging_reserve_request.py +95 -0
- teslafleetmanagementapi/models/operation_request.py +93 -0
- teslafleetmanagementapi/models/orders_response.py +111 -0
- teslafleetmanagementapi/models/pagination.py +225 -0
- teslafleetmanagementapi/models/price_component.py +151 -0
- teslafleetmanagementapi/models/products_response.py +128 -0
- teslafleetmanagementapi/models/public_key_response.py +96 -0
- teslafleetmanagementapi/models/region_response.py +96 -0
- teslafleetmanagementapi/models/register_partner_request.py +92 -0
- teslafleetmanagementapi/models/register_partner_response.py +96 -0
- teslafleetmanagementapi/models/response.py +105 -0
- teslafleetmanagementapi/models/response_1.py +92 -0
- teslafleetmanagementapi/models/response_2.py +95 -0
- teslafleetmanagementapi/models/response_3.py +164 -0
- teslafleetmanagementapi/models/response_api_1_dx_vehicles_options_response.py +112 -0
- teslafleetmanagementapi/models/response_api_1_dx_warranty_details_response.py +169 -0
- teslafleetmanagementapi/models/response_calendar_history_response.py +110 -0
- teslafleetmanagementapi/models/response_charge_history_response.py +98 -0
- teslafleetmanagementapi/models/response_fleet_telemetry_errors_response.py +98 -0
- teslafleetmanagementapi/models/response_live_status_response.py +310 -0
- teslafleetmanagementapi/models/response_me_response.py +131 -0
- teslafleetmanagementapi/models/response_orders_response.py +209 -0
- teslafleetmanagementapi/models/response_public_key_response.py +92 -0
- teslafleetmanagementapi/models/response_region_response.py +105 -0
- teslafleetmanagementapi/models/response_register_partner_response.py +331 -0
- teslafleetmanagementapi/models/signaling.py +118 -0
- teslafleetmanagementapi/models/simple_ok_response.py +105 -0
- teslafleetmanagementapi/models/site_info_response.py +105 -0
- teslafleetmanagementapi/models/storm_mode_request.py +92 -0
- teslafleetmanagementapi/models/tariff_element.py +136 -0
- teslafleetmanagementapi/models/tariffs.py +136 -0
- teslafleetmanagementapi/models/time_of_use_settings_request.py +95 -0
- teslafleetmanagementapi/models/total_cost.py +151 -0
- teslafleetmanagementapi/models/tou_settings.py +105 -0
- teslafleetmanagementapi/models/vehicle_base.py +266 -0
- teslafleetmanagementapi/models/vehicle_option.py +178 -0
- teslafleetmanagementapi/models/warranty_item.py +249 -0
- teslafleetmanagementapi/teslafleetmanagementapi_client.py +128 -0
- teslafleetmanagementapi/utilities/__init__.py +6 -0
- teslafleetmanagementapi/utilities/file_wrapper.py +45 -0
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tesla-api-sdk
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Tesla-API SDK
|
|
5
|
+
Author-email: Muhammad Rafay <muhammad.rafay@apimatic.io>
|
|
6
|
+
Project-URL: Documentation, https://developer.tesla.com/
|
|
7
|
+
Requires-Python: >=3.7
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Dist: apimatic-core>=0.2.24,~=0.2.0
|
|
11
|
+
Requires-Dist: apimatic-core-interfaces>=0.1.8,~=0.1.0
|
|
12
|
+
Requires-Dist: apimatic-requests-client-adapter>=0.1.10,~=0.1.0
|
|
13
|
+
Requires-Dist: python-dotenv<2.0,>=0.21
|
|
14
|
+
Provides-Extra: testutils
|
|
15
|
+
Requires-Dist: pytest>=7.2.2; extra == "testutils"
|
|
16
|
+
Dynamic: license-file
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
# Getting Started with Tesla Fleet Management API
|
|
20
|
+
|
|
21
|
+
## Introduction
|
|
22
|
+
|
|
23
|
+
Unofficial OpenAPI specification for Tesla Fleet Management Charging endpoints.
|
|
24
|
+
|
|
25
|
+
## Install the Package
|
|
26
|
+
|
|
27
|
+
The package is compatible with Python versions `3.7+`.
|
|
28
|
+
Install the package from PyPi using the following pip command:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pip install tesla-api-sdk==1.0.0
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
You can also view the package at:
|
|
35
|
+
https://pypi.python.org/pypi/tesla-api-sdk/1.0.0
|
|
36
|
+
|
|
37
|
+
## Initialize the API Client
|
|
38
|
+
|
|
39
|
+
**_Note:_** Documentation for the client can be found [here.](https://www.github.com/sdks-io/tesla-api-python-sdk/tree/1.0.0/doc/client.md)
|
|
40
|
+
|
|
41
|
+
The following parameters are configurable for the API Client:
|
|
42
|
+
|
|
43
|
+
| Parameter | Type | Description |
|
|
44
|
+
| --- | --- | --- |
|
|
45
|
+
| environment | `Environment` | The API environment. <br> **Default: `Environment.PRODUCTION`** |
|
|
46
|
+
| http_client_instance | `Union[Session, HttpClientProvider]` | The Http Client passed from the sdk user for making requests |
|
|
47
|
+
| override_http_client_configuration | `bool` | The value which determines to override properties of the passed Http Client from the sdk user |
|
|
48
|
+
| http_call_back | `HttpCallBack` | The callback value that is invoked before and after an HTTP call is made to an endpoint |
|
|
49
|
+
| timeout | `float` | The value to use for connection timeout. <br> **Default: 60** |
|
|
50
|
+
| max_retries | `int` | The number of times to retry an endpoint call if it fails. <br> **Default: 0** |
|
|
51
|
+
| backoff_factor | `float` | A backoff factor to apply between attempts after the second try. <br> **Default: 2** |
|
|
52
|
+
| retry_statuses | `Array of int` | The http statuses on which retry is to be done. <br> **Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** |
|
|
53
|
+
| retry_methods | `Array of string` | The http methods on which retry is to be done. <br> **Default: ["GET", "PUT"]** |
|
|
54
|
+
| proxy_settings | [`ProxySettings`](https://www.github.com/sdks-io/tesla-api-python-sdk/tree/1.0.0/doc/proxy-settings.md) | Optional proxy configuration to route HTTP requests through a proxy server. |
|
|
55
|
+
| logging_configuration | [`LoggingConfiguration`](https://www.github.com/sdks-io/tesla-api-python-sdk/tree/1.0.0/doc/logging-configuration.md) | The SDK logging configuration for API calls |
|
|
56
|
+
| bearer_auth_credentials | [`BearerAuthCredentials`](https://www.github.com/sdks-io/tesla-api-python-sdk/tree/1.0.0/doc/auth/oauth-2-bearer-token.md) | The credential object for OAuth 2 Bearer token |
|
|
57
|
+
| oauth_2_credentials | [`Oauth2Credentials`](https://www.github.com/sdks-io/tesla-api-python-sdk/tree/1.0.0/doc/auth/oauth-2-authorization-code-grant.md) | The credential object for OAuth 2 Authorization Code Grant |
|
|
58
|
+
|
|
59
|
+
The API client can be initialized as follows:
|
|
60
|
+
|
|
61
|
+
### Code-Based Client Initialization
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
import logging
|
|
65
|
+
|
|
66
|
+
from teslafleetmanagementapi.configuration import Environment
|
|
67
|
+
from teslafleetmanagementapi.http.auth.bearer_auth import BearerAuthCredentials
|
|
68
|
+
from teslafleetmanagementapi.http.auth.oauth_2 import Oauth2Credentials
|
|
69
|
+
from teslafleetmanagementapi.logging.configuration.api_logging_configuration import LoggingConfiguration
|
|
70
|
+
from teslafleetmanagementapi.logging.configuration.api_logging_configuration import RequestLoggingConfiguration
|
|
71
|
+
from teslafleetmanagementapi.logging.configuration.api_logging_configuration import ResponseLoggingConfiguration
|
|
72
|
+
from teslafleetmanagementapi.teslafleetmanagementapi_client import TeslafleetmanagementapiClient
|
|
73
|
+
|
|
74
|
+
client = TeslafleetmanagementapiClient(
|
|
75
|
+
bearer_auth_credentials=BearerAuthCredentials(
|
|
76
|
+
access_token='AccessToken'
|
|
77
|
+
),
|
|
78
|
+
oauth_2_credentials=Oauth2Credentials(
|
|
79
|
+
oauth_client_id='OAuthClientId',
|
|
80
|
+
oauth_client_secret='OAuthClientSecret',
|
|
81
|
+
oauth_redirect_uri='OAuthRedirectUri'
|
|
82
|
+
),
|
|
83
|
+
environment=Environment.PRODUCTION,
|
|
84
|
+
logging_configuration=LoggingConfiguration(
|
|
85
|
+
log_level=logging.INFO,
|
|
86
|
+
request_logging_config=RequestLoggingConfiguration(
|
|
87
|
+
log_body=True
|
|
88
|
+
),
|
|
89
|
+
response_logging_config=ResponseLoggingConfiguration(
|
|
90
|
+
log_headers=True
|
|
91
|
+
)
|
|
92
|
+
)
|
|
93
|
+
)
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Environment-Based Client Initialization
|
|
97
|
+
|
|
98
|
+
```python
|
|
99
|
+
from teslafleetmanagementapi.teslafleetmanagementapi_client import TeslafleetmanagementapiClient
|
|
100
|
+
|
|
101
|
+
# Specify the path to your .env file if it’s located outside the project’s root directory.
|
|
102
|
+
client = TeslafleetmanagementapiClient.from_environment(dotenv_path='/path/to/.env')
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
See the [Environment-Based Client Initialization](https://www.github.com/sdks-io/tesla-api-python-sdk/tree/1.0.0/doc/environment-based-client-initialization.md) section for details.
|
|
106
|
+
|
|
107
|
+
## Authorization
|
|
108
|
+
|
|
109
|
+
This API uses the following authentication schemes.
|
|
110
|
+
|
|
111
|
+
* [`bearerAuth (OAuth 2 Bearer token)`](https://www.github.com/sdks-io/tesla-api-python-sdk/tree/1.0.0/doc/auth/oauth-2-bearer-token.md)
|
|
112
|
+
* [`oauth2 (OAuth 2 Authorization Code Grant)`](https://www.github.com/sdks-io/tesla-api-python-sdk/tree/1.0.0/doc/auth/oauth-2-authorization-code-grant.md)
|
|
113
|
+
|
|
114
|
+
## List of APIs
|
|
115
|
+
|
|
116
|
+
* [Charging](https://www.github.com/sdks-io/tesla-api-python-sdk/tree/1.0.0/doc/controllers/charging.md)
|
|
117
|
+
* [Energy](https://www.github.com/sdks-io/tesla-api-python-sdk/tree/1.0.0/doc/controllers/energy.md)
|
|
118
|
+
* [Partner](https://www.github.com/sdks-io/tesla-api-python-sdk/tree/1.0.0/doc/controllers/partner.md)
|
|
119
|
+
* [User](https://www.github.com/sdks-io/tesla-api-python-sdk/tree/1.0.0/doc/controllers/user.md)
|
|
120
|
+
* [Vehicles](https://www.github.com/sdks-io/tesla-api-python-sdk/tree/1.0.0/doc/controllers/vehicles.md)
|
|
121
|
+
|
|
122
|
+
## SDK Infrastructure
|
|
123
|
+
|
|
124
|
+
### Configuration
|
|
125
|
+
|
|
126
|
+
* [ProxySettings](https://www.github.com/sdks-io/tesla-api-python-sdk/tree/1.0.0/doc/proxy-settings.md)
|
|
127
|
+
* [Environment-Based Client Initialization](https://www.github.com/sdks-io/tesla-api-python-sdk/tree/1.0.0/doc/environment-based-client-initialization.md)
|
|
128
|
+
* [AbstractLogger](https://www.github.com/sdks-io/tesla-api-python-sdk/tree/1.0.0/doc/abstract-logger.md)
|
|
129
|
+
* [LoggingConfiguration](https://www.github.com/sdks-io/tesla-api-python-sdk/tree/1.0.0/doc/logging-configuration.md)
|
|
130
|
+
* [RequestLoggingConfiguration](https://www.github.com/sdks-io/tesla-api-python-sdk/tree/1.0.0/doc/request-logging-configuration.md)
|
|
131
|
+
* [ResponseLoggingConfiguration](https://www.github.com/sdks-io/tesla-api-python-sdk/tree/1.0.0/doc/response-logging-configuration.md)
|
|
132
|
+
|
|
133
|
+
### HTTP
|
|
134
|
+
|
|
135
|
+
* [HttpResponse](https://www.github.com/sdks-io/tesla-api-python-sdk/tree/1.0.0/doc/http-response.md)
|
|
136
|
+
* [HttpRequest](https://www.github.com/sdks-io/tesla-api-python-sdk/tree/1.0.0/doc/http-request.md)
|
|
137
|
+
|
|
138
|
+
### Utilities
|
|
139
|
+
|
|
140
|
+
* [ApiResponse](https://www.github.com/sdks-io/tesla-api-python-sdk/tree/1.0.0/doc/api-response.md)
|
|
141
|
+
* [ApiHelper](https://www.github.com/sdks-io/tesla-api-python-sdk/tree/1.0.0/doc/api-helper.md)
|
|
142
|
+
* [HttpDateTime](https://www.github.com/sdks-io/tesla-api-python-sdk/tree/1.0.0/doc/http-date-time.md)
|
|
143
|
+
* [RFC3339DateTime](https://www.github.com/sdks-io/tesla-api-python-sdk/tree/1.0.0/doc/rfc3339-date-time.md)
|
|
144
|
+
* [UnixDateTime](https://www.github.com/sdks-io/tesla-api-python-sdk/tree/1.0.0/doc/unix-date-time.md)
|
|
145
|
+
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
tesla_api_sdk-1.0.0.dist-info/licenses/LICENSE,sha256=o5qrSek4x1g9YArvhgZmSORdSoQn7unl7I44zmz7iBc,1213
|
|
2
|
+
teslafleetmanagementapi/__init__.py,sha256=E7NIgboxbvRm8fOqogNH8Y2yjDuOiGW5FAfLtPqbW-A,301
|
|
3
|
+
teslafleetmanagementapi/api_helper.py,sha256=oS6aPLpKimVdkHpVaoYwgutBH3gYAK01f76Edkxiwvg,551
|
|
4
|
+
teslafleetmanagementapi/configuration.py,sha256=XZSTjcAjgEnO6FcofdNtEhuFhu4AZAMPiHUvTGqki2M,10305
|
|
5
|
+
teslafleetmanagementapi/teslafleetmanagementapi_client.py,sha256=h2NIDoW0-IIkQnOA2TZj7Bk99BTcRxQmnMPITT-wgGI,4720
|
|
6
|
+
teslafleetmanagementapi/controllers/__init__.py,sha256=fBFZ8O1rPh4MGG1XH2t6rmC1CGTgniRifCKvLqvaJ-I,316
|
|
7
|
+
teslafleetmanagementapi/controllers/base_controller.py,sha256=bJerm3dBZtp1HqY1tW9RO5FV_-0zzBNNvHJt4WVw0Sw,2126
|
|
8
|
+
teslafleetmanagementapi/controllers/charging_controller.py,sha256=WqfoBxz_kkFcPasI5bSdnVXFDm_jFJFg7tuA-DpKU6Q,5206
|
|
9
|
+
teslafleetmanagementapi/controllers/energy_controller.py,sha256=yQElUTUIrTgteWqFNo1zpNcaPuWH7_0xNE8h-yqxZ28,23556
|
|
10
|
+
teslafleetmanagementapi/controllers/oauth_authorization_controller.py,sha256=0fiZTTOns38P_F33dRuY7YLfk5W3WzmHavBwLkV2s4A,6462
|
|
11
|
+
teslafleetmanagementapi/controllers/partner_controller.py,sha256=nWaBSoiBMC504O79m_7eC9KpWLxOUNZBteNuYkD47kw,6904
|
|
12
|
+
teslafleetmanagementapi/controllers/user_controller.py,sha256=59W0vD9TIOEDqnNxQQ7gYHuoO3JaGzqPSYBSnQwXijk,5929
|
|
13
|
+
teslafleetmanagementapi/controllers/vehicles_controller.py,sha256=KQitnQZNSU3ZLAV7pVwKeDu8-UtHOJ2v2cMDtjHNZEw,32860
|
|
14
|
+
teslafleetmanagementapi/exceptions/__init__.py,sha256=MEYcF4k0hk9cOR4p5KUy3eLzt0MpnhmIPqG1J8Cx5YU,175
|
|
15
|
+
teslafleetmanagementapi/exceptions/api_exception.py,sha256=Rc05JwUFjiUadBv5xl37mEcXcFKjBLk37HCBIGshOmE,1102
|
|
16
|
+
teslafleetmanagementapi/exceptions/oauth_provider_exception.py,sha256=WRJgm---3kaNcTTWHWUdIb3yaLXYN_JnJtwSb9omvGg,2399
|
|
17
|
+
teslafleetmanagementapi/http/__init__.py,sha256=0inmS5sUVyFFK7c7ivfex-inFU1efoAoOvqBEEhTLVo,276
|
|
18
|
+
teslafleetmanagementapi/http/api_response.py,sha256=XXrIYwbUTthNZaPGHJS_y56iL-qPgxtvuWNQwfw_xsI,1985
|
|
19
|
+
teslafleetmanagementapi/http/http_call_back.py,sha256=9WWjvAiCFKAf1TL3lz0dwySsgtLiZnFctnQ5LFHuf7M,477
|
|
20
|
+
teslafleetmanagementapi/http/http_client_provider.py,sha256=32CXQf9yODfBT30RO8CrD9IEkOZKalw4R3W0PZfxAAw,745
|
|
21
|
+
teslafleetmanagementapi/http/http_method_enum.py,sha256=OrxdWAVCuUarb9b6BJ03n3lcEJ71_jz14-CrlhIOGmk,492
|
|
22
|
+
teslafleetmanagementapi/http/http_request.py,sha256=3OoJDXjFp0zqXeX7-lCJQZE-a1Tgxz78Cac0gWpI4tQ,1892
|
|
23
|
+
teslafleetmanagementapi/http/http_response.py,sha256=tWcc-lKAkqiEpcg_OGzhHx-ArUiOk4pRGvgKc23Pza8,1487
|
|
24
|
+
teslafleetmanagementapi/http/proxy_settings.py,sha256=iOH0xt_BPsbv6AmRuQ0IJd2dYgGfxQwNiZJMj4gOthk,1466
|
|
25
|
+
teslafleetmanagementapi/http/auth/__init__.py,sha256=VknVQfXv9tjwq8-puTp8mBF1jHPALWKPmJT6KIDEnqg,156
|
|
26
|
+
teslafleetmanagementapi/http/auth/bearer_auth.py,sha256=ruiUc8_uHrJiGOJVUcnGkSsFOa2dMKEWwnjpQEInOZE,2769
|
|
27
|
+
teslafleetmanagementapi/http/auth/oauth_2.py,sha256=PCzKKXbU55wFZ6dRxH1QLyZgtj1fwloTG9WUYi3eyoc,10386
|
|
28
|
+
teslafleetmanagementapi/logging/__init__.py,sha256=1T_Geb9czAiw7EJDOWfKErjKAmWTkaWBEZBk54UU5bY,161
|
|
29
|
+
teslafleetmanagementapi/logging/sdk_logger.py,sha256=JT1bAsa1zlMfc-EOhZI_ugcY8jgiaORqukxYf9_OuPs,685
|
|
30
|
+
teslafleetmanagementapi/logging/configuration/__init__.py,sha256=HTzMD3CB83jTxGL56Xt5PCqAmFN9GWO6LxcdZ7tN-DA,154
|
|
31
|
+
teslafleetmanagementapi/logging/configuration/api_logging_configuration.py,sha256=kWmsRvS2GbpNKk9QW1qslW4DPjCbg7DpabR3tQqam_E,15459
|
|
32
|
+
teslafleetmanagementapi/models/__init__.py,sha256=goy1acpOwNbiebEHJ97wigYE7ib0RbNv3Xmrc_gbb-0,2509
|
|
33
|
+
teslafleetmanagementapi/models/api_1_dx_vehicles_options_response.py,sha256=vtWXQRcRBTxxewwE2AB3q6s0g_4Dv7CQ5yHvY4MU0eI,3500
|
|
34
|
+
teslafleetmanagementapi/models/api_1_dx_warranty_details_response.py,sha256=QYodUxNHLP3Aoyp9b0e8fE-cGRGkI0umnW1Omzc-PjM,3500
|
|
35
|
+
teslafleetmanagementapi/models/api_1_vehicles_mobile_enabled_response.py,sha256=ZAy-LjyfD8NnbURebB6UMNVFiuunvpcm0CXhI3F74Eg,3375
|
|
36
|
+
teslafleetmanagementapi/models/api_1_vehicles_nearby_charging_sites_response.py,sha256=qtOzCuCuEtbb63AfckHLL-4AHr1WaosSihIGZYn7y3w,3374
|
|
37
|
+
teslafleetmanagementapi/models/api_1_vehicles_response.py,sha256=K1cBhmPiaXQafq3QfbmOnea1uJh9e_18AK28RJH-f-s,4965
|
|
38
|
+
teslafleetmanagementapi/models/api_1_vehicles_response_get_vehicle.py,sha256=Jt1CrZczh14jl5RLvr6eR_VMwQkPkS1S0oMtGoKZhFs,3356
|
|
39
|
+
teslafleetmanagementapi/models/api_1_vehicles_wake_up_response.py,sha256=VXmuPKXV5IuZxjSVyJnXm3nnfOws--GGaNsrULyMVEw,3344
|
|
40
|
+
teslafleetmanagementapi/models/backup_request.py,sha256=-YGN0GqPMTsTqruxHxGDnas7HNvOzDDrwqInXXbBwHk,3116
|
|
41
|
+
teslafleetmanagementapi/models/backup_response.py,sha256=HWHBqKuwwaLvgBiVb29pI6yj3ew2-11azCV715RnGuU,2977
|
|
42
|
+
teslafleetmanagementapi/models/calendar_history_response.py,sha256=0_Qz-3oLrBuGMl4Z4JHXZ0wYf7sFeLVzG-aq4A_Lqio,3134
|
|
43
|
+
teslafleetmanagementapi/models/charge_duration.py,sha256=JDym2IC2YcuEjgjusQxBXWNfEtbSXewnyLwqaSyCeMI,2849
|
|
44
|
+
teslafleetmanagementapi/models/charge_history.py,sha256=qeUxgyvAlqoFVloxR0NAabTFPzL7UCvReJ1X36T1Z-4,4486
|
|
45
|
+
teslafleetmanagementapi/models/charge_history_response.py,sha256=scfbKTYf2Maeu5o5ux0roPuiXAoisFezTghRdDXmUgo,3118
|
|
46
|
+
teslafleetmanagementapi/models/charge_start_time.py,sha256=0wPXdZ-sXtgWqZfX-SRRg6tnP84AwpwdMxq2LxNlif4,2852
|
|
47
|
+
teslafleetmanagementapi/models/charging_dimension.py,sha256=D-fm5mjYNad9UIxvPMgQz9F6S-vVVqkxa7U1vTZSBcY,3772
|
|
48
|
+
teslafleetmanagementapi/models/charging_fee.py,sha256=Ie75mOis7aN19M2FMNRHOFzhC9uVTsoDsr_3HmUkUNw,20982
|
|
49
|
+
teslafleetmanagementapi/models/charging_history_data.py,sha256=a2YItiU4VD4XAHiX7U8MX7SnTl_KP8dHq1j17w9NPJc,3052
|
|
50
|
+
teslafleetmanagementapi/models/charging_history_item.py,sha256=b1pZNFNd0hfSFM8oi8YX4lfz5vKHukRxOEFpYTKRIh0,12077
|
|
51
|
+
teslafleetmanagementapi/models/charging_history_response.py,sha256=eZvJnlvtKKXTLNL9IpeWpQkdhoghcMjM5OB6dH7O79A,3073
|
|
52
|
+
teslafleetmanagementapi/models/charging_invoice.py,sha256=Dad3Gv4_XI__GxaCEC-WR6eDEKCyS-i0U4OqUxXBuDM,4737
|
|
53
|
+
teslafleetmanagementapi/models/charging_location.py,sha256=MjjZSlc4xhi2_Us5AIMGoTxHhrygidS1KvviZj71L8s,9461
|
|
54
|
+
teslafleetmanagementapi/models/charging_period.py,sha256=w5BAkz8FG60t-JipL8TM1c9FN7s4I2VgGNxRZSdxbkE,4351
|
|
55
|
+
teslafleetmanagementapi/models/charging_session.py,sha256=VsiTncoCAP6ZInMxqWug1VAxDBZ7CxwKCTz6Zuikj-E,11319
|
|
56
|
+
teslafleetmanagementapi/models/charging_sessions_data.py,sha256=pAADuNln6VjSbBLoKDGQUv4XDhysLeLmvS2FjanPL14,5737
|
|
57
|
+
teslafleetmanagementapi/models/charging_sessions_response.py,sha256=lapakOI6BUeWg3PM1YvZREB7s_w7lyG-EI9LoyNa8AU,3081
|
|
58
|
+
teslafleetmanagementapi/models/default_real_mode.py,sha256=E-qhyIPMB_XNMHCd9njtGo8xcG-EKg64FV_ei6dHUDI,1358
|
|
59
|
+
teslafleetmanagementapi/models/driver.py,sha256=GJiOCmdm3GxLgcxmwpk_Szi-GENqBC5bI30xysNyfRo,9847
|
|
60
|
+
teslafleetmanagementapi/models/drivers_response.py,sha256=kt94jsWJeVRlQ0K6gp21ioCkfYpvrY7B7cB89Fj3Ajc,4018
|
|
61
|
+
teslafleetmanagementapi/models/enterprise_payer_request.py,sha256=iql7EAcnx5ScqWcL3xlFTGZUJ4DKri4Zui3PXiloesM,4432
|
|
62
|
+
teslafleetmanagementapi/models/event.py,sha256=gn-ikReMV8-T89-6jvk6y3wNz11XHHx7xrS3Zkwi8JM,3479
|
|
63
|
+
teslafleetmanagementapi/models/fleet_status_request.py,sha256=isnp3RdFodMOndwNJPy_MU8FVSL_7BPowYm-EZBogpg,3091
|
|
64
|
+
teslafleetmanagementapi/models/fleet_telemetry_error.py,sha256=aXM0BV9e5BG76ZcfHvHaVZUvvGLPNOOnqSdfqm6eRBs,3574
|
|
65
|
+
teslafleetmanagementapi/models/fleet_telemetry_errors_response.py,sha256=s07Vgc4hLAM_9lq2ChPTijpsJt04EwQ1uMPwFlSh8oQ,3175
|
|
66
|
+
teslafleetmanagementapi/models/fleet_telemetry_jws_request.py,sha256=pSW-Cc7MIm4Ixjqi10EU_b6i3Wi0HU6VfEWmDpiZZLU,3760
|
|
67
|
+
teslafleetmanagementapi/models/generic_update_response.py,sha256=eWY873cCRmOXs3YLDyLyJ2pfNPpoPTrATblEMoWImtI,2998
|
|
68
|
+
teslafleetmanagementapi/models/kind.py,sha256=cogxACF4RnI_suualfNZ6uiPwNuHa-1EYsWCZ8Wrdfg,1294
|
|
69
|
+
teslafleetmanagementapi/models/kind_get_wall_connector_charging_history.py,sha256=9mQ8PMem8CbRBvxuSnzXtYrUmElVdrvn5gugSH6aCWk,1293
|
|
70
|
+
teslafleetmanagementapi/models/live_status_response.py,sha256=Xk29nmHEo1ovIbkROtVgXQY8GWqW8GgOI4krK_Wc-wk,3094
|
|
71
|
+
teslafleetmanagementapi/models/location.py,sha256=2LvXA7K3pAfLx24ypq41w5sQq13Tw11qxOZFaaxToR8,3744
|
|
72
|
+
teslafleetmanagementapi/models/location_1.py,sha256=HZtosA2yx2q0bQWule16BX6jKmevhNzeaCMptpkuG_8,3667
|
|
73
|
+
teslafleetmanagementapi/models/me_response.py,sha256=tB0B25UXRzQ82qhm6nuJIc61yLT0Oy9GdToi354JJBQ,3017
|
|
74
|
+
teslafleetmanagementapi/models/mobile_enabled.py,sha256=KnYNrLvfn3hVy1MF9ZGK0COdoftC7_ERLvP0fm0Xy1Y,3788
|
|
75
|
+
teslafleetmanagementapi/models/oauth_provider_error.py,sha256=F5ebp4-TD9mcjXM5zxSQXdSrnCG_GpLx8ZgUUj47Fxs,2536
|
|
76
|
+
teslafleetmanagementapi/models/oauth_token.py,sha256=2V8ylpLZDu5pmQRCHuqRk_gaZB3rMFmtV0NHd4YL7KY,3610
|
|
77
|
+
teslafleetmanagementapi/models/off_grid_vehicle_charging_reserve_request.py,sha256=qhT_QjrTZD0zyAgPxaNrhQiZPtoTRYn0_3jeZ8t_7D4,3565
|
|
78
|
+
teslafleetmanagementapi/models/operation_request.py,sha256=gl2GNqrT_nhtyecg1sjDTq39ZkuCsMnQh7Em1lkuClI,3071
|
|
79
|
+
teslafleetmanagementapi/models/orders_response.py,sha256=bIjhRwGDSiobTg-YZUwj_jwkDkuXTo9HM0YIS34ZJaQ,3528
|
|
80
|
+
teslafleetmanagementapi/models/pagination.py,sha256=2zoDa9Yj0J6WMjsz7hElMQh4szq5fO5GkYvjAABBUNM,6559
|
|
81
|
+
teslafleetmanagementapi/models/price_component.py,sha256=xQH3JjD-h7a1WQpoUQs-xq0FF54sXBi_VufJTnf0lWA,4484
|
|
82
|
+
teslafleetmanagementapi/models/products_response.py,sha256=I_tJpkpuk3dJL9Ue_VBNIKrZYMvph2uRBVlZQszAbgM,3824
|
|
83
|
+
teslafleetmanagementapi/models/public_key_response.py,sha256=oZbbJUqnelX8l2kN2r6-U85aKoJI1FSxM-k6JUk3AFo,3086
|
|
84
|
+
teslafleetmanagementapi/models/region_response.py,sha256=9GybCfyZ36NiW2FMqf0TqRtl1LB6q337n47IMNU3xq4,3061
|
|
85
|
+
teslafleetmanagementapi/models/register_partner_request.py,sha256=X0mR6NUs_DNxBtAq_0pKAXkFnDKEJ0OvFIX7_Wu0u_k,2855
|
|
86
|
+
teslafleetmanagementapi/models/register_partner_response.py,sha256=3PSxdRJyRUKnytSi1MG9XGbXxRG_NK7a934F2AA0lMg,3134
|
|
87
|
+
teslafleetmanagementapi/models/response.py,sha256=cvHvx3pnGHZeHFbW-0DCMvX8iFuuW1L458vxmnqcA2Y,3213
|
|
88
|
+
teslafleetmanagementapi/models/response_1.py,sha256=1MsZP_K7S3NcfLPR4jqucYhue0avbef4xNRBvq4PWOU,3188
|
|
89
|
+
teslafleetmanagementapi/models/response_2.py,sha256=PByLVIOKWbq4QFF1xtJXTqH_yRFJG25cyC_-iibzMsM,2985
|
|
90
|
+
teslafleetmanagementapi/models/response_3.py,sha256=9iIcl11oaIGzbtxbrkn5mr4lFq8UIK6b3xCSzezZSnA,5461
|
|
91
|
+
teslafleetmanagementapi/models/response_api_1_dx_vehicles_options_response.py,sha256=f_bS0iyloYeMl95PbpnmLBos4dnDGLNGaTgVaXQkh7s,3403
|
|
92
|
+
teslafleetmanagementapi/models/response_api_1_dx_warranty_details_response.py,sha256=PFwaCJc8IEotKYcJ9mYWF_keS3fpaWt4yRlpj7E0erM,5829
|
|
93
|
+
teslafleetmanagementapi/models/response_calendar_history_response.py,sha256=AS8QmgFZZBQKe6-cNENsUf1w_f68jbVDcjfQK0DXgNM,3569
|
|
94
|
+
teslafleetmanagementapi/models/response_charge_history_response.py,sha256=OZqu-pYF-ao74OfVpsmfvlsNwOwtan52ym237D8-tFM,3242
|
|
95
|
+
teslafleetmanagementapi/models/response_fleet_telemetry_errors_response.py,sha256=0DtmO2ZeYxh5KZvkUgYgqEDbV5r_zGu6O7nfHcVFbdE,3446
|
|
96
|
+
teslafleetmanagementapi/models/response_live_status_response.py,sha256=i82mnYiKBQWIQTwaXP_o13AANkpXq4gB8prSg-sUykY,11137
|
|
97
|
+
teslafleetmanagementapi/models/response_me_response.py,sha256=HrLV270rUwn-ZAdIuyD_X8KdEkwvuL5xPSWLU5mBWy8,4414
|
|
98
|
+
teslafleetmanagementapi/models/response_orders_response.py,sha256=bZ3jKTtRGpgBzoGBX8Ml2U_y3Mb1YNXP6Jd7fyEGxic,7438
|
|
99
|
+
teslafleetmanagementapi/models/response_public_key_response.py,sha256=6w5K4LFZftdpFyMbCLAVNOy2DEaNMkR0YtTrguIwrXw,2937
|
|
100
|
+
teslafleetmanagementapi/models/response_region_response.py,sha256=ev8lTS088RDBUqbsHuc8AYnkMCd7mkEAO0FY_WOzmfw,3490
|
|
101
|
+
teslafleetmanagementapi/models/response_register_partner_response.py,sha256=HN3DWGGOcxTlXQz_v_S3gATamvq0t5Po2qcb6UeSr_Y,11127
|
|
102
|
+
teslafleetmanagementapi/models/signaling.py,sha256=RZ6WJy5DY93LHgijbY7oDdsFBfadPjt6kriaDiweJT8,4123
|
|
103
|
+
teslafleetmanagementapi/models/simple_ok_response.py,sha256=NHlM8PVxnaKmmP3JVVB-DW6bmmLqgIU8l2g0h1LSgfk,3161
|
|
104
|
+
teslafleetmanagementapi/models/site_info_response.py,sha256=caR--xgJpTb5ruTItSCrzWuvtJhaOypHF-bHpb3XAYk,3161
|
|
105
|
+
teslafleetmanagementapi/models/storm_mode_request.py,sha256=iZsmULNrT_FTdHISffy4tfezlUW-0m1CQsUATxRQFzI,2862
|
|
106
|
+
teslafleetmanagementapi/models/tariff_element.py,sha256=uH9CGAmK1Mj3d5BJ1FtQW0IzeI8Nef8PYEZEzDqF1G8,4433
|
|
107
|
+
teslafleetmanagementapi/models/tariffs.py,sha256=oWU85DAhLwvQsRkP1tGQzksm1fmgXwSWZhAq167SaC0,4108
|
|
108
|
+
teslafleetmanagementapi/models/time_of_use_settings_request.py,sha256=OuczwKkp4FEz_IHfNkD-Wz1FYOULV6gCYxD-6gRiXrg,3095
|
|
109
|
+
teslafleetmanagementapi/models/total_cost.py,sha256=IUxMggOfwN7hsPionp7dBB7W9fnV5jYogh2-Tvmt-sU,4476
|
|
110
|
+
teslafleetmanagementapi/models/tou_settings.py,sha256=IN6Exg4vze10KG7L8TPit_UrM5bSAmChxqZ1zWzhsY8,3363
|
|
111
|
+
teslafleetmanagementapi/models/vehicle_base.py,sha256=ez4I2WFDCNJtOw6RHt3YbT5CGetudsXylkVm_GrZ7Nc,8289
|
|
112
|
+
teslafleetmanagementapi/models/vehicle_option.py,sha256=8oF-gSte7GeMmZRqM-B8_HbVzmvzxWU0nlw3gAPK_m0,5420
|
|
113
|
+
teslafleetmanagementapi/models/warranty_item.py,sha256=cBa4FwySUhIO9AgxOSfvMYYJUZ0-g6lZvtu4WT2Amfs,9095
|
|
114
|
+
teslafleetmanagementapi/utilities/__init__.py,sha256=pq3szt1E0U5M7qGCe9Vdl_jAM7wSgi8mj-UB-Flp6Ow,160
|
|
115
|
+
teslafleetmanagementapi/utilities/file_wrapper.py,sha256=uyOflQkVT3YGWBy3oKE716gTwCqECcx67ilKbRWDAWQ,1438
|
|
116
|
+
tesla_api_sdk-1.0.0.dist-info/METADATA,sha256=3s_0NqAjcnWO7ngiJlb8PI4QykUwnGj-dlPlxzE7A5o,7543
|
|
117
|
+
tesla_api_sdk-1.0.0.dist-info/WHEEL,sha256=qELbo2s1Yzl39ZmrAibXA2jjPLUYfnVhUNTlyF1rq0Y,92
|
|
118
|
+
tesla_api_sdk-1.0.0.dist-info/top_level.txt,sha256=7DyijchnTRcw5IUZYf9ehvyCZApnY0d-PLaq6b3Le3g,24
|
|
119
|
+
tesla_api_sdk-1.0.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
License:
|
|
2
|
+
========
|
|
3
|
+
The MIT License (MIT)
|
|
4
|
+
http://opensource.org/licenses/MIT
|
|
5
|
+
|
|
6
|
+
Copyright (c) 2014 - 2026 APIMATIC Limited
|
|
7
|
+
|
|
8
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
10
|
+
in the Software without restriction, including without limitation the rights
|
|
11
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
13
|
+
furnished to do so, subject to the following conditions:
|
|
14
|
+
|
|
15
|
+
The above copyright notice and this permission notice shall be included in
|
|
16
|
+
all copies or substantial portions of the Software.
|
|
17
|
+
|
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
24
|
+
THE SOFTWARE.
|
|
25
|
+
|
|
26
|
+
Trade Mark:
|
|
27
|
+
==========
|
|
28
|
+
APIMATIC is a trade mark for APIMATIC Limited
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
teslafleetmanagementapi
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# ruff: noqa: D104 | Missing docstring in public package
|
|
2
|
+
# ruff: noqa: RUF022 | `__all__` is not sorted
|
|
3
|
+
__all__ = [
|
|
4
|
+
"api_helper",
|
|
5
|
+
"configuration",
|
|
6
|
+
"controllers",
|
|
7
|
+
"exceptions",
|
|
8
|
+
"http",
|
|
9
|
+
"logging",
|
|
10
|
+
"models",
|
|
11
|
+
"teslafleetmanagementapi_client",
|
|
12
|
+
"utilities",
|
|
13
|
+
]
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""
|
|
2
|
+
teslafleetmanagementapi
|
|
3
|
+
|
|
4
|
+
This file was automatically generated by APIMATIC v3.0 (
|
|
5
|
+
https://www.apimatic.io ).
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from apimatic_core.utilities.api_helper import ApiHelper as CoreApiHelper
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class APIHelper(CoreApiHelper):
|
|
12
|
+
"""
|
|
13
|
+
A Helper Class for various functions associated with API Calls.
|
|
14
|
+
|
|
15
|
+
This class contains static methods for operations that need to be
|
|
16
|
+
performed during API requests. All of the methods inside this class are
|
|
17
|
+
static methods, there is no need to ever initialise an instance of this
|
|
18
|
+
class.
|
|
19
|
+
"""
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
"""teslafleetmanagementapi.
|
|
2
|
+
|
|
3
|
+
This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
# ruff: noqa: E501
|
|
7
|
+
import os
|
|
8
|
+
from enum import Enum
|
|
9
|
+
|
|
10
|
+
from apimatic_core.http.configurations.http_client_configuration import (
|
|
11
|
+
HttpClientConfiguration,
|
|
12
|
+
)
|
|
13
|
+
from apimatic_requests_client_adapter.requests_client import (
|
|
14
|
+
RequestsClient,
|
|
15
|
+
)
|
|
16
|
+
from dotenv import load_dotenv
|
|
17
|
+
|
|
18
|
+
from teslafleetmanagementapi.http.proxy_settings import (
|
|
19
|
+
ProxySettings,
|
|
20
|
+
)
|
|
21
|
+
from teslafleetmanagementapi.logging.configuration.api_logging_configuration import (
|
|
22
|
+
LoggingConfiguration,
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class Environment(Enum):
|
|
27
|
+
"""An enum for SDK environments."""
|
|
28
|
+
|
|
29
|
+
# Production
|
|
30
|
+
PRODUCTION = 0
|
|
31
|
+
|
|
32
|
+
@classmethod
|
|
33
|
+
def from_value(cls, value, default=None):
|
|
34
|
+
"""Convert a value (string or int) to an Environment enum member.
|
|
35
|
+
|
|
36
|
+
Args:
|
|
37
|
+
value (Union[str, int]): The value to convert.
|
|
38
|
+
default (Environment): The fallback enum member if conversion fails.
|
|
39
|
+
|
|
40
|
+
Returns:
|
|
41
|
+
Environment: Matching enum member or fallback if invalid.
|
|
42
|
+
|
|
43
|
+
"""
|
|
44
|
+
if value is None:
|
|
45
|
+
return default
|
|
46
|
+
|
|
47
|
+
# Try to match directly by enum member
|
|
48
|
+
if isinstance(value, cls):
|
|
49
|
+
return value
|
|
50
|
+
|
|
51
|
+
# Handle integer or string conversion
|
|
52
|
+
for member in cls:
|
|
53
|
+
if (str(member.value).lower() == str(value).lower()
|
|
54
|
+
or member.name.lower() == str(value).lower()):
|
|
55
|
+
return member
|
|
56
|
+
|
|
57
|
+
# Fallback to provided default
|
|
58
|
+
return default
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class Server(Enum):
|
|
62
|
+
"""An enum for API servers."""
|
|
63
|
+
|
|
64
|
+
DEFAULT = 0
|
|
65
|
+
AUTH_SERVER = 1
|
|
66
|
+
|
|
67
|
+
@classmethod
|
|
68
|
+
def from_value(cls, value, default=None):
|
|
69
|
+
"""Convert a value (string or int) to a Server enum member.
|
|
70
|
+
|
|
71
|
+
Args:
|
|
72
|
+
value (Union[str, int]): The value to convert.
|
|
73
|
+
default (Server): The fallback enum member if conversion fails.
|
|
74
|
+
|
|
75
|
+
Returns:
|
|
76
|
+
Server: Matching enum member or fallback if invalid.
|
|
77
|
+
|
|
78
|
+
"""
|
|
79
|
+
if value is None:
|
|
80
|
+
return default
|
|
81
|
+
|
|
82
|
+
# Try to match directly by enum member
|
|
83
|
+
if isinstance(value, cls):
|
|
84
|
+
return value
|
|
85
|
+
|
|
86
|
+
# Handle integer or string conversion
|
|
87
|
+
for member in cls:
|
|
88
|
+
if (str(member.value).lower() == str(value).lower()
|
|
89
|
+
or member.name.lower() == str(value).lower()):
|
|
90
|
+
return member
|
|
91
|
+
|
|
92
|
+
# Fallback to provided default
|
|
93
|
+
return default
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
class Configuration(HttpClientConfiguration):
|
|
97
|
+
"""A class used for configuring the SDK by a user."""
|
|
98
|
+
|
|
99
|
+
@property
|
|
100
|
+
def environment(self):
|
|
101
|
+
"""Return current environment."""
|
|
102
|
+
return self._environment
|
|
103
|
+
|
|
104
|
+
@property
|
|
105
|
+
def bearer_auth_credentials(self):
|
|
106
|
+
"""Return current bearer_auth_credentials."""
|
|
107
|
+
return self._bearer_auth_credentials
|
|
108
|
+
|
|
109
|
+
@property
|
|
110
|
+
def oauth_2_credentials(self):
|
|
111
|
+
"""Return current oauth_2_credentials."""
|
|
112
|
+
return self._oauth_2_credentials
|
|
113
|
+
|
|
114
|
+
def __init__(self, http_client_instance=None,
|
|
115
|
+
override_http_client_configuration=False, http_call_back=None,
|
|
116
|
+
timeout=60, max_retries=0, backoff_factor=2, retry_statuses=None,
|
|
117
|
+
retry_methods=None, proxy_settings=None, logging_configuration=None,
|
|
118
|
+
environment=Environment.PRODUCTION, bearer_auth_credentials=None,
|
|
119
|
+
oauth_2_credentials=None):
|
|
120
|
+
"""Initialize Configuration object."""
|
|
121
|
+
if retry_methods is None:
|
|
122
|
+
retry_methods = ["GET", "PUT"]
|
|
123
|
+
|
|
124
|
+
if retry_statuses is None:
|
|
125
|
+
retry_statuses = [408, 413, 429, 500, 502, 503, 504, 521,
|
|
126
|
+
522, 524]
|
|
127
|
+
|
|
128
|
+
super().__init__(
|
|
129
|
+
http_client_instance=http_client_instance,
|
|
130
|
+
override_http_client_configuration=override_http_client_configuration,
|
|
131
|
+
http_call_back=http_call_back, timeout=timeout,
|
|
132
|
+
max_retries=max_retries, backoff_factor=backoff_factor,
|
|
133
|
+
retry_statuses=retry_statuses, retry_methods=retry_methods,
|
|
134
|
+
proxy_settings=proxy_settings,
|
|
135
|
+
logging_configuration=logging_configuration,
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
# Current API environment
|
|
139
|
+
self._environment = environment
|
|
140
|
+
|
|
141
|
+
# The object holding OAuth 2 Bearer token credentials
|
|
142
|
+
self._bearer_auth_credentials = bearer_auth_credentials
|
|
143
|
+
|
|
144
|
+
# The object holding OAuth 2 Authorization Code Grant credentials
|
|
145
|
+
self._oauth_2_credentials = oauth_2_credentials
|
|
146
|
+
|
|
147
|
+
# The Http Client to use for making requests.
|
|
148
|
+
self.set_http_client(self.create_http_client())
|
|
149
|
+
|
|
150
|
+
def clone_with(self, http_client_instance=None,
|
|
151
|
+
override_http_client_configuration=None, http_call_back=None,
|
|
152
|
+
timeout=None, max_retries=None, backoff_factor=None,
|
|
153
|
+
retry_statuses=None, retry_methods=None, proxy_settings=None,
|
|
154
|
+
logging_configuration=None, environment=None,
|
|
155
|
+
bearer_auth_credentials=None, oauth_2_credentials=None):
|
|
156
|
+
"""Clone configuration with overrides."""
|
|
157
|
+
http_client_instance = http_client_instance or self.http_client_instance
|
|
158
|
+
override_http_client_configuration =\
|
|
159
|
+
(override_http_client_configuration
|
|
160
|
+
or self.override_http_client_configuration)
|
|
161
|
+
http_call_back = http_call_back or self.http_callback
|
|
162
|
+
timeout = timeout or self.timeout
|
|
163
|
+
max_retries = max_retries or self.max_retries
|
|
164
|
+
backoff_factor = backoff_factor or self.backoff_factor
|
|
165
|
+
retry_statuses = retry_statuses or self.retry_statuses
|
|
166
|
+
retry_methods = retry_methods or self.retry_methods
|
|
167
|
+
proxy_settings = proxy_settings or self.proxy_settings
|
|
168
|
+
logging_configuration = logging_configuration or self.logging_configuration
|
|
169
|
+
environment = environment or self.environment
|
|
170
|
+
bearer_auth_credentials =\
|
|
171
|
+
(bearer_auth_credentials
|
|
172
|
+
or self.bearer_auth_credentials)
|
|
173
|
+
oauth_2_credentials = oauth_2_credentials or self.oauth_2_credentials
|
|
174
|
+
return Configuration(
|
|
175
|
+
http_client_instance=http_client_instance,
|
|
176
|
+
override_http_client_configuration=override_http_client_configuration,
|
|
177
|
+
http_call_back=http_call_back, timeout=timeout, max_retries=max_retries,
|
|
178
|
+
backoff_factor=backoff_factor, retry_statuses=retry_statuses,
|
|
179
|
+
retry_methods=retry_methods, proxy_settings=proxy_settings,
|
|
180
|
+
logging_configuration=logging_configuration, environment=environment,
|
|
181
|
+
bearer_auth_credentials=bearer_auth_credentials,
|
|
182
|
+
oauth_2_credentials=oauth_2_credentials,
|
|
183
|
+
)
|
|
184
|
+
|
|
185
|
+
def create_http_client(self):
|
|
186
|
+
"""Create the HTTP client instance."""
|
|
187
|
+
return RequestsClient(
|
|
188
|
+
timeout=self.timeout, max_retries=self.max_retries,
|
|
189
|
+
backoff_factor=self.backoff_factor, retry_statuses=self.retry_statuses,
|
|
190
|
+
retry_methods=self.retry_methods,
|
|
191
|
+
http_client_instance=self.http_client_instance,
|
|
192
|
+
override_http_client_configuration=self.override_http_client_configuration,
|
|
193
|
+
response_factory=self.http_response_factory,
|
|
194
|
+
proxies=self.proxy_settings.to_proxies() if self.proxy_settings else None,
|
|
195
|
+
)
|
|
196
|
+
|
|
197
|
+
# All the environments the SDK can run in
|
|
198
|
+
environments = {
|
|
199
|
+
Environment.PRODUCTION: {
|
|
200
|
+
Server.DEFAULT: "https://fleet-api.prd.na.vn.cloud.tesla.com",
|
|
201
|
+
Server.AUTH_SERVER: "https://auth.tesla.com/oauth2/v3",
|
|
202
|
+
},
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
def get_base_uri(self, server=Server.DEFAULT):
|
|
206
|
+
"""Generate the appropriate base URI for the environment and the server.
|
|
207
|
+
|
|
208
|
+
Args:
|
|
209
|
+
server (Configuration.Server): The server enum for which the base
|
|
210
|
+
URI is required.
|
|
211
|
+
|
|
212
|
+
Returns:
|
|
213
|
+
String: The base URI.
|
|
214
|
+
|
|
215
|
+
"""
|
|
216
|
+
return self.environments[self.environment][server]
|
|
217
|
+
|
|
218
|
+
@classmethod
|
|
219
|
+
def from_environment(cls, dotenv_path=None, **overrides):
|
|
220
|
+
"""Create Configuration object from .env and environment variables.
|
|
221
|
+
|
|
222
|
+
Args:
|
|
223
|
+
dotenv_path (str, optional): Path to the .env file to load.
|
|
224
|
+
If None, the default .env file is used.
|
|
225
|
+
**overrides: Optional values overriding setting from environment variables.
|
|
226
|
+
|
|
227
|
+
Returns:
|
|
228
|
+
Configuration: A configuration object populated with the resolved values.
|
|
229
|
+
|
|
230
|
+
"""
|
|
231
|
+
# load .env automatically
|
|
232
|
+
load_dotenv(dotenv_path or None, override=True)
|
|
233
|
+
|
|
234
|
+
override_http_client_configuration = os.getenv(
|
|
235
|
+
"OVERRIDE_HTTP_CLIENT_CONFIGURATION", "false").lower() == "true"
|
|
236
|
+
timeout = int(os.getenv("TIMEOUT", "60"))
|
|
237
|
+
max_retries = int(os.getenv("MAX_RETRIES", "0"))
|
|
238
|
+
backoff_factor = float(os.getenv("BACKOFF_FACTOR", "2"))
|
|
239
|
+
statuses = os.getenv("RETRY_STATUSES", None)
|
|
240
|
+
retry_statuses = [int(v.strip()) for v in statuses.split(",")
|
|
241
|
+
if v.strip().isdigit()] if statuses else None
|
|
242
|
+
methods = os.getenv("RETRY_METHODS", None)
|
|
243
|
+
retry_methods = [v.strip() for v in methods.split(",") if v.strip()]\
|
|
244
|
+
if methods else None
|
|
245
|
+
environment = Environment.from_value(
|
|
246
|
+
os.getenv("ENVIRONMENT"), Environment.PRODUCTION)
|
|
247
|
+
|
|
248
|
+
from teslafleetmanagementapi.http.auth.bearer_auth import (
|
|
249
|
+
BearerAuthCredentials,
|
|
250
|
+
)
|
|
251
|
+
from teslafleetmanagementapi.http.auth.oauth_2 import (
|
|
252
|
+
Oauth2Credentials,
|
|
253
|
+
)
|
|
254
|
+
|
|
255
|
+
# Preparing default configuration
|
|
256
|
+
default_config = cls(
|
|
257
|
+
override_http_client_configuration=override_http_client_configuration,
|
|
258
|
+
timeout=timeout,
|
|
259
|
+
max_retries=max_retries,
|
|
260
|
+
backoff_factor=backoff_factor,
|
|
261
|
+
retry_statuses=retry_statuses,
|
|
262
|
+
retry_methods=retry_methods,
|
|
263
|
+
environment=environment,
|
|
264
|
+
proxy_settings=ProxySettings.from_environment(),
|
|
265
|
+
logging_configuration=LoggingConfiguration.from_environment(),
|
|
266
|
+
bearer_auth_credentials=BearerAuthCredentials.from_environment(),
|
|
267
|
+
oauth_2_credentials=Oauth2Credentials.from_environment(),
|
|
268
|
+
)
|
|
269
|
+
|
|
270
|
+
return default_config.clone_with(**overrides)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# ruff: noqa: D104 | Missing docstring in public package
|
|
2
|
+
# ruff: noqa: RUF022 | `__all__` is not sorted
|
|
3
|
+
__all__ = [
|
|
4
|
+
"base_controller",
|
|
5
|
+
"charging_controller",
|
|
6
|
+
"energy_controller",
|
|
7
|
+
"oauth_authorization_controller",
|
|
8
|
+
"partner_controller",
|
|
9
|
+
"user_controller",
|
|
10
|
+
"vehicles_controller",
|
|
11
|
+
]
|