python-chargepoint 2.3.0__tar.gz → 2.3.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.
- {python_chargepoint-2.3.0 → python_chargepoint-2.3.2}/PKG-INFO +1 -1
- {python_chargepoint-2.3.0 → python_chargepoint-2.3.2}/pyproject.toml +2 -2
- {python_chargepoint-2.3.0 → python_chargepoint-2.3.2}/python_chargepoint/__main__.py +0 -1
- {python_chargepoint-2.3.0 → python_chargepoint-2.3.2}/python_chargepoint/client.py +9 -0
- {python_chargepoint-2.3.0 → python_chargepoint-2.3.2}/LICENSE +0 -0
- {python_chargepoint-2.3.0 → python_chargepoint-2.3.2}/README.md +0 -0
- {python_chargepoint-2.3.0 → python_chargepoint-2.3.2}/python_chargepoint/__init__.py +0 -0
- {python_chargepoint-2.3.0 → python_chargepoint-2.3.2}/python_chargepoint/constants.py +0 -0
- {python_chargepoint-2.3.0 → python_chargepoint-2.3.2}/python_chargepoint/exceptions.py +0 -0
- {python_chargepoint-2.3.0 → python_chargepoint-2.3.2}/python_chargepoint/global_config.py +0 -0
- {python_chargepoint-2.3.0 → python_chargepoint-2.3.2}/python_chargepoint/session.py +0 -0
- {python_chargepoint-2.3.0 → python_chargepoint-2.3.2}/python_chargepoint/types.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "python-chargepoint"
|
|
3
|
-
version = "2.3.
|
|
3
|
+
version = "2.3.2"
|
|
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"
|
|
@@ -20,7 +20,7 @@ chargepoint = "python_chargepoint.__main__:cli"
|
|
|
20
20
|
|
|
21
21
|
[tool.poetry.group.dev.dependencies]
|
|
22
22
|
tox = "^3.24.5"
|
|
23
|
-
black = "^
|
|
23
|
+
black = "^26.1.0"
|
|
24
24
|
pytest = "^7.0"
|
|
25
25
|
aioresponses = "^0.7"
|
|
26
26
|
pytest-asyncio = "^0.23"
|
|
@@ -13,7 +13,6 @@ from .constants import _LOGGER
|
|
|
13
13
|
from .exceptions import CommunicationError, InvalidSession, LoginError
|
|
14
14
|
from .types import MapFilter, ZoomBounds
|
|
15
15
|
|
|
16
|
-
|
|
17
16
|
# ---------------------------------------------------------------------------
|
|
18
17
|
# Helpers
|
|
19
18
|
# ---------------------------------------------------------------------------
|
|
@@ -41,6 +41,7 @@ USER_AGENT = f"{MODULE_NAME}/{MODULE_VERSION}"
|
|
|
41
41
|
COULOMB_SESSION = "coulomb_sess"
|
|
42
42
|
SSO_SESSION = "auth-session"
|
|
43
43
|
COOKIE_DOMAIN = ".chargepoint.com"
|
|
44
|
+
_COULOMB_SESSION_MAX_AGE = 10 * 365 * 24 * 3600
|
|
44
45
|
|
|
45
46
|
|
|
46
47
|
def _require_login(func):
|
|
@@ -115,6 +116,7 @@ class ChargePoint:
|
|
|
115
116
|
cookie[COULOMB_SESSION] = parsed
|
|
116
117
|
cookie[COULOMB_SESSION]["domain"] = COOKIE_DOMAIN
|
|
117
118
|
cookie[COULOMB_SESSION]["path"] = "/"
|
|
119
|
+
cookie[COULOMB_SESSION]["max-age"] = str(_COULOMB_SESSION_MAX_AGE)
|
|
118
120
|
self._session.cookie_jar.update_cookies(
|
|
119
121
|
cookie, response_url=URL(f"https://account{COOKIE_DOMAIN}/")
|
|
120
122
|
)
|
|
@@ -129,6 +131,13 @@ class ChargePoint:
|
|
|
129
131
|
_LOGGER.debug("[%s] %s", method, url)
|
|
130
132
|
headers = {**self._request_headers, **kwargs.pop("headers", {})}
|
|
131
133
|
response = await self._session.request(method, url, headers=headers, **kwargs)
|
|
134
|
+
|
|
135
|
+
# ChargePoint servers return coulomb_sess with Max-Age=7200 on every response.
|
|
136
|
+
# Re-set it without expiry so the cookie jar never evicts it.
|
|
137
|
+
refreshed = response.cookies.get(COULOMB_SESSION)
|
|
138
|
+
if refreshed and refreshed.value:
|
|
139
|
+
self._set_coulomb_token(refreshed.value)
|
|
140
|
+
|
|
132
141
|
_LOGGER.debug("Status: %d", response.status)
|
|
133
142
|
_LOGGER.debug("Request Headers: %s", response.request_info.headers)
|
|
134
143
|
_LOGGER.debug("Response Headers: %s", response.headers)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|