Commit 7e039cb
authored
Fix nonce, add auto retry on auth exception, fix session id int, improve code quality (#336)
This pull request includes several changes to improve error handling,
enhance functionality, and update configurations. The most important
changes include adding new exception handling for invalid sessions,
updating the `postCreateCommand` in the devcontainer, and adding custom
funding options.
### Error Handling Improvements:
* Added `InvalidSessionException` to handle invalid session errors and
updated relevant methods to raise this exception when needed
(`sagemcom_api/client.py`, `sagemcom_api/const.py`,
`sagemcom_api/exceptions.py`).
[[1]](diffhunk://#diff-052218051094ff1cc2c8352cd555cfb9eb02bf261eb5e635cf73b798809306a5R32)
[[2]](diffhunk://#diff-052218051094ff1cc2c8352cd555cfb9eb02bf261eb5e635cf73b798809306a5R46)
[[3]](diffhunk://#diff-052218051094ff1cc2c8352cd555cfb9eb02bf261eb5e635cf73b798809306a5R220-R225)
[[4]](diffhunk://#diff-57cf505b5e01fc69f170c5a1b839fb40b45a97a9c0ebc1fe53f4bd524ae9ac04R10)
[[5]](diffhunk://#diff-63c847110513149341a9f7e94d412bfb7c67d79df07a321774a9a2f3329ca34fR4-L43)
* Introduced `retry_login` function to retry login on specific
exceptions using backoff (`sagemcom_api/client.py`).
[[1]](diffhunk://#diff-052218051094ff1cc2c8352cd555cfb9eb02bf261eb5e635cf73b798809306a5R58-R62)
[[2]](diffhunk://#diff-052218051094ff1cc2c8352cd555cfb9eb02bf261eb5e635cf73b798809306a5R260-R270)
### Functional Enhancements:
* Modified `get_hosts` method to include `capability-flags` in the
options for retrieving hosts (`sagemcom_api/client.py`).
* Corrected the nonce generation logic to use the correct range
(`sagemcom_api/client.py`).
### Configuration Updates:
* Updated `postCreateCommand` in `.devcontainer/devcontainer.json` to
include `pre-commit install-hooks` for better pre-commit setup.
* Added a custom funding option in `.github/FUNDING.yml` to include a
PayPal link.1 parent 3da2376 commit 7e039cb
File tree
5 files changed
+63
-24
lines changed- .devcontainer
- .github
- sagemcom_api
5 files changed
+63
-24
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
| |||
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
| 32 | + | |
30 | 33 | | |
31 | 34 | | |
32 | 35 | | |
| |||
40 | 43 | | |
41 | 44 | | |
42 | 45 | | |
| 46 | + | |
43 | 47 | | |
44 | 48 | | |
45 | 49 | | |
| |||
51 | 55 | | |
52 | 56 | | |
53 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
54 | 63 | | |
55 | 64 | | |
56 | 65 | | |
| |||
118 | 127 | | |
119 | 128 | | |
120 | 129 | | |
121 | | - | |
| 130 | + | |
122 | 131 | | |
123 | 132 | | |
124 | 133 | | |
| |||
187 | 196 | | |
188 | 197 | | |
189 | 198 | | |
| 199 | + | |
190 | 200 | | |
191 | 201 | | |
192 | 202 | | |
| |||
207 | 217 | | |
208 | 218 | | |
209 | 219 | | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
210 | 226 | | |
211 | 227 | | |
212 | 228 | | |
| |||
241 | 257 | | |
242 | 258 | | |
243 | 259 | | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
244 | 271 | | |
245 | 272 | | |
246 | 273 | | |
| |||
252 | 279 | | |
253 | 280 | | |
254 | 281 | | |
255 | | - | |
| 282 | + | |
256 | 283 | | |
257 | 284 | | |
258 | 285 | | |
| |||
435 | 462 | | |
436 | 463 | | |
437 | 464 | | |
438 | | - | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
439 | 468 | | |
440 | 469 | | |
441 | 470 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
4 | 21 | | |
5 | | - | |
| 22 | + | |
6 | 23 | | |
7 | 24 | | |
8 | 25 | | |
9 | | - | |
| 26 | + | |
10 | 27 | | |
11 | 28 | | |
12 | 29 | | |
13 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
14 | 35 | | |
15 | 36 | | |
16 | 37 | | |
17 | | - | |
| 38 | + | |
18 | 39 | | |
19 | 40 | | |
20 | 41 | | |
21 | | - | |
| 42 | + | |
22 | 43 | | |
23 | 44 | | |
24 | 45 | | |
25 | | - | |
| 46 | + | |
26 | 47 | | |
27 | 48 | | |
28 | 49 | | |
29 | | - | |
| 50 | + | |
30 | 51 | | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
| |||
0 commit comments