python-chargepoint 2.0.0__tar.gz → 2.0.1__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.0.0
3
+ Version: 2.0.1
4
4
  Summary: A simple, Pythonic wrapper for the ChargePoint API.
5
5
  License: MIT
6
6
  License-File: LICENSE
@@ -77,6 +77,28 @@ await client.login_with_sso_session("<sso jwt>")
77
77
 
78
78
  ---
79
79
 
80
+ ### Obtaining Tokens Manually
81
+
82
+ Password-based login may be blocked by bot-protection (Datadome). When that happens,
83
+ you can capture a token directly from your browser and pass it to the client.
84
+
85
+ 1. Open [https://driver.chargepoint.com](https://driver.chargepoint.com) in your browser and log in normally.
86
+ 2. Open Developer Tools and navigate to **Application > Cookies > https://driver.chargepoint.com**.
87
+ 3. Copy the value of one of the following cookies:
88
+
89
+ | Cookie | Use as |
90
+ |---|---|
91
+ | `coulomb_sess` | `coulomb_token=` (recommended — long-lived) |
92
+ | `auth-session` | `login_with_sso_session()` (shorter-lived JWT) |
93
+
94
+ > **Note:** The `coulomb_sess` value contains `#` and `?` characters. The library handles both raw and URL-encoded (`%23`, `%3F`) forms automatically. When setting it as a shell environment variable, always wrap the value in **double quotes** to prevent the shell from interpreting `#` as a comment:
95
+ >
96
+ > ```bash
97
+ > export CP_COULOMB_TOKEN="Ab3dEf...token...#D???????#RNA-US"
98
+ > ```
99
+
100
+ ---
101
+
80
102
  ### Account
81
103
 
82
104
  ```python
@@ -56,6 +56,28 @@ await client.login_with_sso_session("<sso jwt>")
56
56
 
57
57
  ---
58
58
 
59
+ ### Obtaining Tokens Manually
60
+
61
+ Password-based login may be blocked by bot-protection (Datadome). When that happens,
62
+ you can capture a token directly from your browser and pass it to the client.
63
+
64
+ 1. Open [https://driver.chargepoint.com](https://driver.chargepoint.com) in your browser and log in normally.
65
+ 2. Open Developer Tools and navigate to **Application > Cookies > https://driver.chargepoint.com**.
66
+ 3. Copy the value of one of the following cookies:
67
+
68
+ | Cookie | Use as |
69
+ |---|---|
70
+ | `coulomb_sess` | `coulomb_token=` (recommended — long-lived) |
71
+ | `auth-session` | `login_with_sso_session()` (shorter-lived JWT) |
72
+
73
+ > **Note:** The `coulomb_sess` value contains `#` and `?` characters. The library handles both raw and URL-encoded (`%23`, `%3F`) forms automatically. When setting it as a shell environment variable, always wrap the value in **double quotes** to prevent the shell from interpreting `#` as a comment:
74
+ >
75
+ > ```bash
76
+ > export CP_COULOMB_TOKEN="Ab3dEf...token...#D???????#RNA-US"
77
+ > ```
78
+
79
+ ---
80
+
59
81
  ### Account
60
82
 
61
83
  ```python
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "python-chargepoint"
3
- version = "2.0.0"
3
+ version = "2.0.1"
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"
@@ -189,6 +189,18 @@ class ChargePoint:
189
189
  await self._init_account_parameters()
190
190
  return
191
191
 
192
+ if login.status == 403:
193
+ try:
194
+ body = await login.json(content_type=None)
195
+ if "url" in body:
196
+ raise DatadomeCaptcha(
197
+ body["url"], "Login blocked by Datadome captcha."
198
+ )
199
+ except DatadomeCaptcha:
200
+ raise
201
+ except Exception:
202
+ pass
203
+
192
204
  _LOGGER.error(
193
205
  "Failed to get auth token! status_code=%s err=%s",
194
206
  login.status,