python-chargepoint 2.3.2__tar.gz → 2.4.0__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-chargepoint
3
- Version: 2.3.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,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "python-chargepoint"
3
- version = "2.3.2"
3
+ version = "2.4.0"
4
4
  description = "A simple, Pythonic wrapper for the ChargePoint API."
5
5
  authors = ["Marc Billow <mbillow@users.noreply.github.compoetry>"]
6
6
  license = "MIT"
@@ -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._request_headers = {"user-agent": USER_AGENT}
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(login_url, json=request) as login:
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(url, cookies={SSO_SESSION: sso_jwt}) as response:
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)