python-chargepoint 2.3.2__py3-none-any.whl → 2.4.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.
- python_chargepoint/client.py +13 -4
- {python_chargepoint-2.3.2.dist-info → python_chargepoint-2.4.0.dist-info}/METADATA +2 -1
- {python_chargepoint-2.3.2.dist-info → python_chargepoint-2.4.0.dist-info}/RECORD +6 -6
- {python_chargepoint-2.3.2.dist-info → python_chargepoint-2.4.0.dist-info}/WHEEL +1 -1
- {python_chargepoint-2.3.2.dist-info → python_chargepoint-2.4.0.dist-info}/entry_points.txt +0 -0
- {python_chargepoint-2.3.2.dist-info → python_chargepoint-2.4.0.dist-info}/licenses/LICENSE +0 -0
python_chargepoint/client.py
CHANGED
|
@@ -61,11 +61,13 @@ class ChargePoint:
|
|
|
61
61
|
username: str,
|
|
62
62
|
coulomb_token: str = "",
|
|
63
63
|
session: Optional[aiohttp.ClientSession] = None,
|
|
64
|
+
user_agent: Optional[str] = None,
|
|
64
65
|
):
|
|
65
66
|
self._username = username
|
|
66
67
|
self._user_id: Optional[int] = None
|
|
67
68
|
self._global_config: GlobalConfiguration
|
|
68
|
-
self.
|
|
69
|
+
self._user_agent = user_agent or USER_AGENT
|
|
70
|
+
self._request_headers = {"user-agent": self._user_agent}
|
|
69
71
|
self._owns_session = session is None
|
|
70
72
|
|
|
71
73
|
if session is not None:
|
|
@@ -82,8 +84,9 @@ class ChargePoint:
|
|
|
82
84
|
username: str,
|
|
83
85
|
coulomb_token: str = "",
|
|
84
86
|
session: Optional[aiohttp.ClientSession] = None,
|
|
87
|
+
user_agent: Optional[str] = None,
|
|
85
88
|
) -> ChargePoint:
|
|
86
|
-
client = cls(username, coulomb_token, session)
|
|
89
|
+
client = cls(username, coulomb_token, session, user_agent)
|
|
87
90
|
client._global_config = await client._get_configuration(username)
|
|
88
91
|
if coulomb_token:
|
|
89
92
|
await client._init_account_parameters()
|
|
@@ -204,7 +207,9 @@ class ChargePoint:
|
|
|
204
207
|
_LOGGER.debug(
|
|
205
208
|
"Attempting client login (%s) with user: %s", login_url, self._username
|
|
206
209
|
)
|
|
207
|
-
async with self._session.post(
|
|
210
|
+
async with self._session.post(
|
|
211
|
+
login_url, json=request, headers={"user-agent": self._user_agent}
|
|
212
|
+
) as login:
|
|
208
213
|
cookie_morsel = login.cookies.get(COULOMB_SESSION)
|
|
209
214
|
if login.status == 200 and cookie_morsel:
|
|
210
215
|
self._set_coulomb_token(cookie_morsel.value)
|
|
@@ -236,7 +241,11 @@ class ChargePoint:
|
|
|
236
241
|
self._global_config.endpoints.portal_domain_endpoint
|
|
237
242
|
/ "index.php/nghelper/getSession"
|
|
238
243
|
)
|
|
239
|
-
async with self._session.get(
|
|
244
|
+
async with self._session.get(
|
|
245
|
+
url,
|
|
246
|
+
cookies={SSO_SESSION: sso_jwt},
|
|
247
|
+
headers={"user-agent": self._user_agent},
|
|
248
|
+
) as response:
|
|
240
249
|
cookie_morsel = response.cookies.get(COULOMB_SESSION)
|
|
241
250
|
if response.status == 200 and cookie_morsel:
|
|
242
251
|
self._set_coulomb_token(cookie_morsel.value)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-chargepoint
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.4.0
|
|
4
4
|
Summary: A simple, Pythonic wrapper for the ChargePoint API.
|
|
5
5
|
License: MIT
|
|
6
6
|
License-File: LICENSE
|
|
@@ -14,6 +14,7 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.12
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.13
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.14
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
17
18
|
Requires-Dist: aiohttp (>=3.9,<4.0)
|
|
18
19
|
Requires-Dist: click (>=8.1,<9.0)
|
|
19
20
|
Requires-Dist: pydantic (>=2.12,<3.0)
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
python_chargepoint/__init__.py,sha256=feCQnVAAkCZr5iz9BWOl6YrwcKmcEnpH598Js0w-hxk,46
|
|
2
2
|
python_chargepoint/__main__.py,sha256=ESNHXnAVYtaLPYvDnv4sAe9Ef2e2MiyPvavfrNwlFtE,25641
|
|
3
|
-
python_chargepoint/client.py,sha256
|
|
3
|
+
python_chargepoint/client.py,sha256=OEUMNsO3e1D_jjY40HvuU1KhqC4w8V3W-PfDVFjKv7Y,20401
|
|
4
4
|
python_chargepoint/constants.py,sha256=mu_-syPG4BGtFbhuIjWYqGMmwyxvPoz9g9WP7UmCMT4,172
|
|
5
5
|
python_chargepoint/exceptions.py,sha256=b1UwI6NdpCNWjlbB_5onh0bgVP0xz8587hpPPOt0l7Y,1030
|
|
6
6
|
python_chargepoint/global_config.py,sha256=8ysnnz5iQNMsuxgd_P8fkO-1pHP2kLcFoKvFJ7EeYR0,2532
|
|
7
7
|
python_chargepoint/session.py,sha256=OqC39dhGxW7YZgDMQYRNHY-3E_5zOEQwQNXAixh4dmQ,9321
|
|
8
8
|
python_chargepoint/types.py,sha256=W_WsF6pTgH9L8GDWHeJZRn-MAbFf-LTmpZzClx_AttE,13258
|
|
9
|
-
python_chargepoint-2.
|
|
10
|
-
python_chargepoint-2.
|
|
11
|
-
python_chargepoint-2.
|
|
12
|
-
python_chargepoint-2.
|
|
13
|
-
python_chargepoint-2.
|
|
9
|
+
python_chargepoint-2.4.0.dist-info/METADATA,sha256=IfdxqCL3CgGWwNqH2QhstfvxXRzIGYNjowbei9EKFok,11474
|
|
10
|
+
python_chargepoint-2.4.0.dist-info/WHEEL,sha256=L-WvLdSBvJWHXv5zrQxDvNRnIgoBzLUpcbuiw19KCuQ,88
|
|
11
|
+
python_chargepoint-2.4.0.dist-info/entry_points.txt,sha256=OxFvfpoOLgWQvG2FWRgL_HwBmQXRmYxAJ0OUiFI3Fw0,63
|
|
12
|
+
python_chargepoint-2.4.0.dist-info/licenses/LICENSE,sha256=GoS0DqJF8iBnSxm3URezwTm7rsUxhBv1-odhHhLlg8I,1054
|
|
13
|
+
python_chargepoint-2.4.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|