Commit eed179d
Rc/3.0 redux (#49)
* Update CHANGELOG in preparation for release.
* fix behavior for terminal acronyms like in studentIEPs (#47)
* Update changelog with latest commit.
* Update CHANGELOG with imminent additions in migrate_from_rc branch.
* Feature/migrate session from rc (#40)
* Refactor entire library to use EdFiSession from rc/0.3.0 branch; use logging library; remove Ed-Fi 2 functionality.
* Fix bugs across repo.
* Implements basic plain-text file cache for auth tokens
* Make token base path configurable
* Move token load/update from cache into separate method
* Add test with forced refreshes
* Refactor portalocker caching into its own class
* Add pure Python soft lock based token cache
* Have token caches implement abstract base class
* For soft lockfile, impelement staleness threshold
* Tweak tests and default timeout
* Adds tests for get_token_info and for instance-specific auth endpoint
* Add test for max_retries on paged requests
* Add test for default behavior of retries off
* Fix no-retry default test to add check for total call count
* Make access_token a property to force authentication if accessed before first request.
* Migrate get_instance_locator() code into instance_locator property.
* Improve docstrings to clarify cleanup logic for posted records.
* Update get_rows/pages docstrings and reorder arguments for clarity.
* Update API year error to install latest 0.2 version.
* Fix mock in get_token_info test to chdeck for JSON-encoded POST body
* Incorporate from main auth URL fixes for specific API mode.
* Feature/persist tokens to disk cleanup (#45)
* Add Python 3.10 requirement (and fix indentation).
* Clean up comments, whitespace, and method order in Session.
* Move snapshot header setting outside internal auth helper method.
* Pass max_retries argument into read_lock.
* Move time attribute setters and cached token reauthentication into their respective helpers.
* Clean up whitespacing, type hints, comments, and variable names; move shared definitions of `exists()` and `get_last_modified()` helpers into BaseTokenCache().
* Move shared abstract methods back into interface to allow future child class that caches non-locally.
* Define refresh_at outside the helper call to ensure this argument can also be defined using cached tokens.
* Bugfixes and make caller responsible for constructing TokenCache
In preparation for removing PortalockerTokenCache (and leaving the pure Python
LockfileTokenCache as the only option), shift instantiation and configuration
of token caches onto the caller.
- Replace `use_token_cache` parameter in EdFiClient with `token_cache`; caller
must pass in instantiated token cache in order to use caching feature.
- Remove `token_cache_lock_type` parameter and corresponding match/case from
EdFiClient.
- Add `token_id` property to BaseTokenCache abstract base class. Now that we
expect a token cache to be instantiated outside of EdFiSession, sessions will
have to pass in instance-client IDs, used to uniquely identify shared tokens,
after instantiation. Implement such a setter in LockfileTokenCache that
updates cache and lockfile paths upon being passed a new ID.
- Update tests to follow this new pattern.
Bug introduced in cleanup where EdFiSession.refresh_at was None even though
EdFiSession.authenticated_at was not, occurring in non-cache code path. Session
would call _make_auth_request, which does not update both timestamps.
- Have _make_auth_request set both timestamps, not just authenticated_at.
- Factor out token loading into EdFiSession._load_token_from_cache, a method
that also updates both timestamps and shares the same signature as
_make_auth_request. This should make the invariant more clear.
Bug found in testing where LockfileTokenCache.get_write_lock would error out
when `os.path.getmtime` was called on a nonexistent lockfile because the
lockfile had been deleted in between the `os.path.exists` check and the
`getmtime` call. Fixed with an extra branch in an existing try/except catching this
FileNotFoundError. Could be addressed by another try/except that would allow us
to try to acquire the write lock immediately, but this seems more readable and
easier to reason about.
* Remove portalocker caching implementation
* Move parameters into __init__ to allow for caller to control token caches
* Tweak test_multiprocessing_with_forced_refreshes interval to force more invalidations
* Push uniqueness responsibility down to token caches instead of EdFiSession
* Rename missing variable.
* Rename object imported to match typing.
* Linting/type checking fixes for token caching
- Explicit `typing.cast` to narrow down types for Optional instance attributes
- Fixing various timestamps to ints
- Missing type hints
- Default string/PathLike values to get rid of Optional types
- Unused imports, unused variable fixes
* Add mocked test for default uncached client fetching own token
* Fix EdFiSession.connect type hint
* Fix re-auth on stale token from cache
* Update setup.py metadata for release.
* Add additional comments for test against live ODS
* Add token caching info to README
---------
Co-authored-by: Alex Chen <achen@edanalytics.org>
Co-authored-by: Alex C. <alchenist@users.noreply.github.com>
* Update README with new features of the release candidate.
* Add instance_locator to Swagger URL. (#48)
* Update CHANGELOG.
---------
Co-authored-by: rlittle08 <rlittle@edanalytics.org>
Co-authored-by: Alex Chen <achen@edanalytics.org>
Co-authored-by: Alex C. <alchenist@users.noreply.github.com>1 parent 9bc2cb9 commit eed179d
11 files changed
Lines changed: 1430 additions & 783 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
1 | 20 | | |
2 | 21 | | |
3 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
| 53 | + | |
| 54 | + | |
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
| |||
84 | 85 | | |
85 | 86 | | |
86 | 87 | | |
87 | | - | |
88 | | - | |
89 | 88 | | |
90 | 89 | | |
91 | 90 | | |
| |||
104 | 103 | | |
105 | 104 | | |
106 | 105 | | |
107 | | - | |
108 | | - | |
109 | 106 | | |
110 | 107 | | |
111 | 108 | | |
| |||
128 | 125 | | |
129 | 126 | | |
130 | 127 | | |
131 | | - | |
132 | | - | |
133 | 128 | | |
134 | 129 | | |
135 | 130 | | |
| |||
159 | 154 | | |
160 | 155 | | |
161 | 156 | | |
162 | | - | |
163 | | - | |
164 | 157 | | |
165 | 158 | | |
166 | 159 | | |
| |||
176 | 169 | | |
177 | 170 | | |
178 | 171 | | |
179 | | - | |
180 | | - | |
181 | 172 | | |
182 | 173 | | |
183 | 174 | | |
| |||
196 | 187 | | |
197 | 188 | | |
198 | 189 | | |
199 | | - | |
200 | | - | |
201 | 190 | | |
202 | 191 | | |
203 | 192 | | |
| |||
216 | 205 | | |
217 | 206 | | |
218 | 207 | | |
219 | | - | |
220 | | - | |
221 | 208 | | |
222 | 209 | | |
223 | 210 | | |
| |||
245 | 232 | | |
246 | 233 | | |
247 | 234 | | |
248 | | - | |
249 | | - | |
| 235 | + | |
250 | 236 | | |
251 | 237 | | |
252 | 238 | | |
253 | 239 | | |
254 | 240 | | |
255 | 241 | | |
| 242 | + | |
| 243 | + | |
256 | 244 | | |
257 | 245 | | |
258 | 246 | | |
259 | 247 | | |
260 | 248 | | |
261 | 249 | | |
262 | 250 | | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
263 | 272 | | |
264 | 273 | | |
265 | 274 | | |
266 | 275 | | |
267 | 276 | | |
268 | 277 | | |
269 | | - | |
270 | 278 | | |
271 | 279 | | |
272 | 280 | | |
| |||
288 | 296 | | |
289 | 297 | | |
290 | 298 | | |
291 | | - | |
| 299 | + | |
292 | 300 | | |
293 | 301 | | |
294 | 302 | | |
| |||
318 | 326 | | |
319 | 327 | | |
320 | 328 | | |
321 | | - | |
| 329 | + | |
322 | 330 | | |
323 | 331 | | |
324 | 332 | | |
| |||
348 | 356 | | |
349 | 357 | | |
350 | 358 | | |
351 | | - | |
| 359 | + | |
352 | 360 | | |
353 | 361 | | |
354 | 362 | | |
| |||
453 | 461 | | |
454 | 462 | | |
455 | 463 | | |
| 464 | + | |
| 465 | + | |
456 | 466 | | |
457 | 467 | | |
458 | 468 | | |
| |||
479 | 489 | | |
480 | 490 | | |
481 | 491 | | |
| 492 | + | |
| 493 | + | |
482 | 494 | | |
483 | 495 | | |
484 | 496 | | |
| |||
521 | 533 | | |
522 | 534 | | |
523 | 535 | | |
| 536 | + | |
| 537 | + | |
524 | 538 | | |
525 | 539 | | |
526 | 540 | | |
527 | 541 | | |
528 | 542 | | |
529 | 543 | | |
530 | | - | |
| 544 | + | |
531 | 545 | | |
532 | 546 | | |
533 | 547 | | |
534 | | - | |
| 548 | + | |
535 | 549 | | |
536 | 550 | | |
537 | 551 | | |
538 | 552 | | |
539 | | - | |
| 553 | + | |
540 | 554 | | |
541 | 555 | | |
542 | 556 | | |
543 | | - | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
544 | 560 | | |
545 | 561 | | |
546 | 562 | | |
| |||
692 | 708 | | |
693 | 709 | | |
694 | 710 | | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
0 commit comments