librus-python-api 1.10.0__py3-none-any.whl → 1.10.2__py3-none-any.whl
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.
- librus_python_api/__init__.py +1 -1
- librus_python_api/completed_lessons.py +4 -1
- librus_python_api/config.py +27 -4
- librus_python_api/gateway_grades.py +172 -33
- librus_python_api/markup.py +6 -4
- librus_python_api/service.py +14 -9
- {librus_python_api-1.10.0.dist-info → librus_python_api-1.10.2.dist-info}/METADATA +7 -4
- {librus_python_api-1.10.0.dist-info → librus_python_api-1.10.2.dist-info}/RECORD +10 -10
- {librus_python_api-1.10.0.dist-info → librus_python_api-1.10.2.dist-info}/WHEEL +0 -0
- {librus_python_api-1.10.0.dist-info → librus_python_api-1.10.2.dist-info}/licenses/LICENSE +0 -0
librus_python_api/__init__.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""Independent bounded async client. General live compatibility is unqualified."""
|
|
2
2
|
|
|
3
3
|
# Before the imports: config reads it for the User-Agent.
|
|
4
|
-
__version__ = "1.10.
|
|
4
|
+
__version__ = "1.10.2"
|
|
5
5
|
|
|
6
6
|
from librus_python_api.attachments import AttachmentStream, ModernAttachmentStream
|
|
7
7
|
from librus_python_api.budget import RequestBudget
|
|
@@ -203,8 +203,11 @@ def _lesson(
|
|
|
203
203
|
raw_number, combined, topic, z_value, symbol = values
|
|
204
204
|
if raw_number not in {"", "-"} and re.fullmatch(r"[0-9]{1,2}", raw_number) is None:
|
|
205
205
|
raise LibrusError(ErrorKind.PARSE)
|
|
206
|
-
# Some schools render "<b>Subject</b>, <br>Teacher" or pad the comma.
|
|
206
|
+
# Some schools render "<b>Subject</b>, <br>Teacher" or pad the comma. More
|
|
207
|
+
# than one comma leaves the subject/teacher boundary ambiguous, so fail.
|
|
207
208
|
names = [name.strip() for name in combined.split(",")]
|
|
209
|
+
if len(names) > 2:
|
|
210
|
+
raise LibrusError(ErrorKind.PARSE)
|
|
208
211
|
subject, teacher = (names[0], names[1]) if len(names) == 2 else (combined, None)
|
|
209
212
|
if not subject or teacher == "":
|
|
210
213
|
raise LibrusError(ErrorKind.PARSE)
|
librus_python_api/config.py
CHANGED
|
@@ -760,11 +760,13 @@ TOOLTIP_LABELS = frozenset(
|
|
|
760
760
|
"Maksymalna ilość punktów",
|
|
761
761
|
"Nauczyciel",
|
|
762
762
|
"Obowiązek wyk. zadania",
|
|
763
|
+
"Obszar oceniania",
|
|
763
764
|
"Ocena",
|
|
764
765
|
"Poprawa oceny",
|
|
765
766
|
"Rodzaj",
|
|
766
767
|
"Suma punktów",
|
|
767
768
|
"Temat zajęć",
|
|
769
|
+
"Umiejętność",
|
|
768
770
|
"Waga",
|
|
769
771
|
"Zakres do",
|
|
770
772
|
"Zakres od",
|
|
@@ -807,12 +809,29 @@ GRADE_PERIOD_HEADERS = MappingProxyType(
|
|
|
807
809
|
"Ocena roczna": 0,
|
|
808
810
|
}
|
|
809
811
|
)
|
|
810
|
-
# New-schema descriptive grading: the page renders this table
|
|
812
|
+
# New-schema descriptive grading: the page renders this table with empty
|
|
811
813
|
# `gradesCell` semester cells, which its script fills from the gateway routes
|
|
812
|
-
# above,
|
|
814
|
+
# above, with bare semester text, or with grade boxes and filled detail rows;
|
|
815
|
+
# the last two need no gateway read.
|
|
813
816
|
DESCRIPTIVE_TABLE_CLASS = "newSchemaGradesByStudentTable"
|
|
814
817
|
DESCRIPTIVE_ROW_CLASS = "studentRow"
|
|
815
818
|
DESCRIPTIVE_DETAILS_ROW_CLASS = "studentGradesDetailsRow"
|
|
819
|
+
DESCRIPTIVE_DETAILS_CELL_CLASS = "studentGradesDetailsCell"
|
|
820
|
+
# A filled detail row's table (2026-11-15, reported page, #173): these column
|
|
821
|
+
# labels, then per period a heading row with one `DESCRIPTIVE_PERIOD_LABELS` cell and
|
|
822
|
+
# either `detail-grades` rows or one empty-marker row.
|
|
823
|
+
DESCRIPTIVE_DETAIL_COLUMNS = (
|
|
824
|
+
"Ocena",
|
|
825
|
+
"K",
|
|
826
|
+
"Obszar oceniania",
|
|
827
|
+
"Umiejętność",
|
|
828
|
+
"Data",
|
|
829
|
+
"Nauczyciel",
|
|
830
|
+
"Treść oceny",
|
|
831
|
+
"Dodał",
|
|
832
|
+
)
|
|
833
|
+
DESCRIPTIVE_DETAIL_GRADE_ROW_CLASS = "detail-grades"
|
|
834
|
+
DESCRIPTIVE_PERIOD_LABELS = MappingProxyType({"Okres 1": 1, "Okres 2": 2})
|
|
816
835
|
# Gateway account and student identifiers are opaque strings, unlike every
|
|
817
836
|
# other `{id}` route, which takes a numeric ID.
|
|
818
837
|
DESCRIPTIVE_IDENTIFIER = re.compile(r"[A-Za-z0-9_-]{1,128}")
|
|
@@ -1033,8 +1052,12 @@ HOMEWORK_MARK_DONE_HANDLER = (
|
|
|
1033
1052
|
r"\s*showConfirmQuestion\(\s*[0-9]{1,64}\s*,\s*[0-9]{1,64}\s*\);?\s*"
|
|
1034
1053
|
)
|
|
1035
1054
|
WEEKDAY_LABELS = ("pon.", "wt.", "śr.", "czw.", "pt.", "sob.", "ndz.")
|
|
1036
|
-
#
|
|
1037
|
-
|
|
1055
|
+
# Accepted labels per weekday (Monday first) after a civil date. Grade
|
|
1056
|
+
# tooltips also use the short Sunday display label.
|
|
1057
|
+
CIVIL_DATE_WEEKDAY_LABELS: tuple[tuple[str, ...], ...] = (
|
|
1058
|
+
*((label,) for label in WEEKDAY_LABELS[:-1]),
|
|
1059
|
+
(WEEKDAY_LABELS[-1], "nd."),
|
|
1060
|
+
)
|
|
1038
1061
|
# Observed page-level notices shown instead of the requested content.
|
|
1039
1062
|
PAGE_NOTICES = MappingProxyType(
|
|
1040
1063
|
{
|
|
@@ -10,9 +10,10 @@ the pagination member, `{"limit", "page", "total"}` integers beside `data` or
|
|
|
10
10
|
shape fails instead of producing a partial collection.
|
|
11
11
|
|
|
12
12
|
Another school renders the same table with plain text in its semester cells and
|
|
13
|
-
no script hooks (#115, from a reporter's synthetic example)
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
no script hooks (#115, from a reporter's synthetic example), and another with
|
|
14
|
+
grade boxes in them and filled detail rows that list the same grades (#173,
|
|
15
|
+
from a reporter's sanitized page). The grade record parser reads those cells
|
|
16
|
+
like any descriptive row, so neither table needs a gateway read.
|
|
16
17
|
"""
|
|
17
18
|
|
|
18
19
|
import re
|
|
@@ -27,13 +28,18 @@ from pydantic import BaseModel, ConfigDict, Field, ValidationError, field_valida
|
|
|
27
28
|
|
|
28
29
|
from librus_python_api import markup
|
|
29
30
|
from librus_python_api.config import (
|
|
31
|
+
DESCRIPTIVE_DETAIL_COLUMNS,
|
|
32
|
+
DESCRIPTIVE_DETAIL_GRADE_ROW_CLASS,
|
|
33
|
+
DESCRIPTIVE_DETAILS_CELL_CLASS,
|
|
30
34
|
DESCRIPTIVE_DETAILS_ROW_CLASS,
|
|
31
35
|
DESCRIPTIVE_IDENTIFIER,
|
|
32
36
|
DESCRIPTIVE_MAX_NAME_LENGTH,
|
|
33
37
|
DESCRIPTIVE_MAX_SUBJECTS,
|
|
34
38
|
DESCRIPTIVE_MAX_USERS,
|
|
39
|
+
DESCRIPTIVE_PERIOD_LABELS,
|
|
35
40
|
DESCRIPTIVE_ROW_CLASS,
|
|
36
41
|
DESCRIPTIVE_TABLE_CLASS,
|
|
42
|
+
GRADE_EMPTY_MARKERS,
|
|
37
43
|
GRADE_MAX_METADATA_LENGTH,
|
|
38
44
|
GRADE_MAX_RECORDS,
|
|
39
45
|
GRADE_MAX_SUBJECTS,
|
|
@@ -309,14 +315,118 @@ def _classes(element: html.HtmlElement) -> set[str]:
|
|
|
309
315
|
return set(element.get("class", "").split())
|
|
310
316
|
|
|
311
317
|
|
|
318
|
+
_Grades = list[tuple[str, date]]
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
def _box_grades(cell: html.HtmlElement) -> _Grades | None:
|
|
322
|
+
"""Value and date of each grade box in a semester cell of the box layout.
|
|
323
|
+
|
|
324
|
+
The cell has no attributes and holds either only grade boxes, each one
|
|
325
|
+
link with no markup, or a bare empty marker (no grades). Anything else is
|
|
326
|
+
None. The record parser reads and validates the same boxes.
|
|
327
|
+
"""
|
|
328
|
+
if cell.attrib:
|
|
329
|
+
return None
|
|
330
|
+
elements = [node for node in cell if isinstance(node.tag, str)]
|
|
331
|
+
if not elements:
|
|
332
|
+
value = markup.text(cell)
|
|
333
|
+
return [] if value and value in GRADE_EMPTY_MARKERS else None
|
|
334
|
+
if (cell.text or "").strip() or any((node.tail or "").strip() for node in cell):
|
|
335
|
+
return None
|
|
336
|
+
result: _Grades = []
|
|
337
|
+
for box in elements:
|
|
338
|
+
links = [node for node in box if isinstance(node.tag, str)]
|
|
339
|
+
if (
|
|
340
|
+
box.tag != "span"
|
|
341
|
+
or "grade-box" not in _classes(box)
|
|
342
|
+
or (box.text or "").strip()
|
|
343
|
+
or len(links) != 1
|
|
344
|
+
or links[0].tag != "a"
|
|
345
|
+
or len(links[0])
|
|
346
|
+
or (links[0].tail or "").strip()
|
|
347
|
+
):
|
|
348
|
+
return None
|
|
349
|
+
fields = markup.tooltip_fields(links[0])
|
|
350
|
+
result.append((markup.text(links[0]), markup.civil_date(fields.get("Data"))))
|
|
351
|
+
return result
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
def _detail_grades(cell: html.HtmlElement) -> dict[int, _Grades]:
|
|
355
|
+
"""Value and date of each grade in a filled detail row, by period.
|
|
356
|
+
|
|
357
|
+
The cell holds one table: `DESCRIPTIVE_DETAIL_COLUMNS` as its header, then
|
|
358
|
+
per period a heading row and either grade rows or one empty-marker row,
|
|
359
|
+
and an empty footer. A grade row with `Treść oceny` text fails: the grade
|
|
360
|
+
boxes carry no such field, so the text would be lost.
|
|
361
|
+
"""
|
|
362
|
+
unsupported = LibrusError(ErrorKind.UNSUPPORTED_CAPABILITY)
|
|
363
|
+
tables = [node for node in cell if isinstance(node.tag, str)]
|
|
364
|
+
if (
|
|
365
|
+
len(tables) != 1
|
|
366
|
+
or tables[0].tag != "table"
|
|
367
|
+
or (cell.text or "").strip()
|
|
368
|
+
or (tables[0].tail or "").strip()
|
|
369
|
+
):
|
|
370
|
+
raise unsupported
|
|
371
|
+
result: dict[int, _Grades] = {}
|
|
372
|
+
empty: set[int] = set()
|
|
373
|
+
header = False
|
|
374
|
+
period: int | None = None
|
|
375
|
+
for row in markup.rows(tables[0]):
|
|
376
|
+
cells = markup.cells(row)
|
|
377
|
+
texts = [markup.text(item) for item in cells]
|
|
378
|
+
if markup.in_header(row):
|
|
379
|
+
if header or texts != list(DESCRIPTIVE_DETAIL_COLUMNS):
|
|
380
|
+
raise unsupported
|
|
381
|
+
header = True
|
|
382
|
+
elif next(row.iterancestors("tfoot"), None) is not None:
|
|
383
|
+
if any(texts) or any(len(item) for item in cells):
|
|
384
|
+
raise unsupported
|
|
385
|
+
elif len(cells) == 1 and texts[0] in DESCRIPTIVE_PERIOD_LABELS:
|
|
386
|
+
period = DESCRIPTIVE_PERIOD_LABELS[texts[0]]
|
|
387
|
+
if period in result or len(cells[0]):
|
|
388
|
+
raise unsupported
|
|
389
|
+
result[period] = []
|
|
390
|
+
elif period is None or period in empty:
|
|
391
|
+
raise unsupported
|
|
392
|
+
elif len(cells) == 1:
|
|
393
|
+
if result[period] or texts[0] not in GRADE_EMPTY_MARKERS - {""}:
|
|
394
|
+
raise unsupported
|
|
395
|
+
if len(cells[0]):
|
|
396
|
+
raise unsupported
|
|
397
|
+
empty.add(period)
|
|
398
|
+
elif (
|
|
399
|
+
DESCRIPTIVE_DETAIL_GRADE_ROW_CLASS in _classes(row)
|
|
400
|
+
and len(cells) == len(DESCRIPTIVE_DETAIL_COLUMNS)
|
|
401
|
+
and texts[0]
|
|
402
|
+
and not texts[DESCRIPTIVE_DETAIL_COLUMNS.index("Treść oceny")]
|
|
403
|
+
):
|
|
404
|
+
day = texts[DESCRIPTIVE_DETAIL_COLUMNS.index("Data")]
|
|
405
|
+
result[period].append((texts[0], markup.civil_date(day)))
|
|
406
|
+
else:
|
|
407
|
+
raise unsupported
|
|
408
|
+
if not header or sorted(result) != [1, 2]:
|
|
409
|
+
raise unsupported
|
|
410
|
+
if any(not result[key] and key not in empty for key in result):
|
|
411
|
+
raise unsupported
|
|
412
|
+
return result
|
|
413
|
+
|
|
414
|
+
|
|
312
415
|
def read_descriptive_table(document: html.HtmlElement) -> DescriptiveTable | None:
|
|
313
416
|
"""The new-schema subject table, or None when the page has none.
|
|
314
417
|
|
|
315
|
-
Its rows hold an expander, the subject and two semester cells
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
418
|
+
Its rows hold an expander, the subject and two semester cells, in one of
|
|
419
|
+
three layouts that `read_grade_records` reads, with no gateway grades
|
|
420
|
+
except in the first:
|
|
421
|
+
|
|
422
|
+
- empty `gradesCell` cells that the page script fills from the gateway;
|
|
423
|
+
- bare text cells the page filled itself (#115), with no detail rows;
|
|
424
|
+
- grade boxes or a bare empty marker (2026-11-15, #173), with a filled
|
|
425
|
+
`studentGradesDetailsRow` for every subject row that lists the same
|
|
426
|
+
grades, value and date, in the same order.
|
|
427
|
+
|
|
428
|
+
A script cell the page already filled would duplicate the gateway records,
|
|
429
|
+
so it is unsupported, as is any other cell or a table mixing layouts.
|
|
320
430
|
"""
|
|
321
431
|
tables = [
|
|
322
432
|
table
|
|
@@ -338,6 +448,26 @@ def read_descriptive_table(document: html.HtmlElement) -> DescriptiveTable | Non
|
|
|
338
448
|
if not populated:
|
|
339
449
|
return None
|
|
340
450
|
tables = populated
|
|
451
|
+
detail_rows = [
|
|
452
|
+
row
|
|
453
|
+
for row in markup.rows(tables[0])
|
|
454
|
+
if DESCRIPTIVE_DETAILS_ROW_CLASS in _classes(row)
|
|
455
|
+
]
|
|
456
|
+
# Detail rows the page script fills from the gateway are empty; filled
|
|
457
|
+
# ones hold a table and belong to the box layout.
|
|
458
|
+
rendered = any(next(row.iter("table"), None) is not None for row in detail_rows)
|
|
459
|
+
details: dict[str, dict[int, _Grades]] = {}
|
|
460
|
+
if rendered:
|
|
461
|
+
for row in detail_rows:
|
|
462
|
+
cells = markup.cells(row)
|
|
463
|
+
if len(cells) != 1 or DESCRIPTIVE_DETAILS_CELL_CLASS not in _classes(
|
|
464
|
+
cells[0]
|
|
465
|
+
):
|
|
466
|
+
raise LibrusError(ErrorKind.UNSUPPORTED_CAPABILITY)
|
|
467
|
+
key = row.get("data-subject_id", "")
|
|
468
|
+
if key in details:
|
|
469
|
+
raise LibrusError(ErrorKind.PARSE)
|
|
470
|
+
details[key] = _detail_grades(cells[0])
|
|
341
471
|
subjects: dict[int, str] = {}
|
|
342
472
|
students: set[str | None] = set()
|
|
343
473
|
layouts: set[bool] = set()
|
|
@@ -350,26 +480,36 @@ def read_descriptive_table(document: html.HtmlElement) -> DescriptiveTable | Non
|
|
|
350
480
|
):
|
|
351
481
|
raise LibrusError(ErrorKind.UNSUPPORTED_CAPABILITY)
|
|
352
482
|
semesters = cells[2:]
|
|
353
|
-
# A filled cell is bare text: no attributes and no markup, so a renamed
|
|
354
|
-
# or moved script hook never passes as a filled table.
|
|
355
|
-
filled = all(
|
|
356
|
-
not cell.attrib
|
|
357
|
-
and markup.text(cell)
|
|
358
|
-
and not any(isinstance(node.tag, str) for node in cell)
|
|
359
|
-
for cell in semesters
|
|
360
|
-
)
|
|
361
|
-
if not filled and (
|
|
362
|
-
[cell.get("data-semester") for cell in semesters] != ["1", "2"]
|
|
363
|
-
or not all("gradesCell" in _classes(cell) for cell in semesters)
|
|
364
|
-
):
|
|
365
|
-
raise LibrusError(ErrorKind.UNSUPPORTED_CAPABILITY)
|
|
366
|
-
layouts.add(filled)
|
|
367
|
-
if not filled and any(
|
|
368
|
-
markup.text(cell) or any(isinstance(node.tag, str) for node in cell)
|
|
369
|
-
for cell in semesters
|
|
370
|
-
):
|
|
371
|
-
raise LibrusError(ErrorKind.UNSUPPORTED_CAPABILITY)
|
|
372
483
|
identifier = row.get("data-subject_id", "")
|
|
484
|
+
if rendered:
|
|
485
|
+
boxes = [_box_grades(cell) for cell in semesters]
|
|
486
|
+
if boxes[0] is None or boxes[1] is None:
|
|
487
|
+
raise LibrusError(ErrorKind.UNSUPPORTED_CAPABILITY)
|
|
488
|
+
# The detail row must list exactly the grades the boxes show; any
|
|
489
|
+
# other grade there would be dropped.
|
|
490
|
+
if details.pop(identifier, None) != {1: boxes[0], 2: boxes[1]}:
|
|
491
|
+
raise LibrusError(ErrorKind.UNSUPPORTED_CAPABILITY)
|
|
492
|
+
filled = True
|
|
493
|
+
else:
|
|
494
|
+
# A filled cell is bare text: no attributes and no markup, so a
|
|
495
|
+
# renamed or moved script hook never passes as a filled table.
|
|
496
|
+
filled = all(
|
|
497
|
+
not cell.attrib
|
|
498
|
+
and markup.text(cell)
|
|
499
|
+
and not any(isinstance(node.tag, str) for node in cell)
|
|
500
|
+
for cell in semesters
|
|
501
|
+
)
|
|
502
|
+
if not filled and (
|
|
503
|
+
[cell.get("data-semester") for cell in semesters] != ["1", "2"]
|
|
504
|
+
or not all("gradesCell" in _classes(cell) for cell in semesters)
|
|
505
|
+
):
|
|
506
|
+
raise LibrusError(ErrorKind.UNSUPPORTED_CAPABILITY)
|
|
507
|
+
if not filled and any(
|
|
508
|
+
markup.text(cell) or any(isinstance(node.tag, str) for node in cell)
|
|
509
|
+
for cell in semesters
|
|
510
|
+
):
|
|
511
|
+
raise LibrusError(ErrorKind.UNSUPPORTED_CAPABILITY)
|
|
512
|
+
layouts.add(filled)
|
|
373
513
|
name = markup.text(cells[1])
|
|
374
514
|
if not re.fullmatch(r"[0-9]{1,18}", identifier) or not name:
|
|
375
515
|
raise LibrusError(ErrorKind.PARSE)
|
|
@@ -382,13 +522,12 @@ def read_descriptive_table(document: html.HtmlElement) -> DescriptiveTable | Non
|
|
|
382
522
|
if len(students) > 1:
|
|
383
523
|
# One page shows one student; rows of several students are unknown.
|
|
384
524
|
raise LibrusError(ErrorKind.PARSE)
|
|
385
|
-
if len(layouts) > 1:
|
|
525
|
+
if len(layouts) > 1 or details:
|
|
526
|
+
# Mixed layouts, or a filled detail row without its subject row.
|
|
386
527
|
raise LibrusError(ErrorKind.UNSUPPORTED_CAPABILITY)
|
|
387
|
-
if layouts == {True} and
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
# Detail rows are what the page script fills from the gateway; a filled
|
|
391
|
-
# table that still has them may also have gateway grades.
|
|
528
|
+
if not rendered and layouts == {True} and detail_rows:
|
|
529
|
+
# Empty detail rows are what the page script fills from the gateway; a
|
|
530
|
+
# bare-text table that still has them may also have gateway grades.
|
|
392
531
|
raise LibrusError(ErrorKind.UNSUPPORTED_CAPABILITY)
|
|
393
532
|
return DescriptiveTable(MappingProxyType(subjects), layouts == {True})
|
|
394
533
|
|
librus_python_api/markup.py
CHANGED
|
@@ -164,14 +164,16 @@ def tooltip_line(chunk: str) -> str:
|
|
|
164
164
|
def civil_date(value: str | None) -> date:
|
|
165
165
|
"""An ISO date, optionally followed by its weekday label in parentheses."""
|
|
166
166
|
match = re.fullmatch(r"([0-9]{4}-[0-9]{2}-[0-9]{2})(?: \(([^()]+)\))?", value or "")
|
|
167
|
-
if match is None
|
|
168
|
-
match[2] is not None and match[2] not in CIVIL_DATE_WEEKDAY_LABELS
|
|
169
|
-
):
|
|
167
|
+
if match is None:
|
|
170
168
|
raise LibrusError(ErrorKind.PARSE)
|
|
171
169
|
try:
|
|
172
|
-
|
|
170
|
+
day = date.fromisoformat(match[1])
|
|
173
171
|
except ValueError:
|
|
174
172
|
pass
|
|
173
|
+
else:
|
|
174
|
+
# A label must name the date's own weekday, as for homework dates.
|
|
175
|
+
if match[2] is None or match[2] in CIVIL_DATE_WEEKDAY_LABELS[day.weekday()]:
|
|
176
|
+
return day
|
|
175
177
|
raise LibrusError(ErrorKind.PARSE)
|
|
176
178
|
|
|
177
179
|
|
librus_python_api/service.py
CHANGED
|
@@ -1331,10 +1331,12 @@ class AccountClient:
|
|
|
1331
1331
|
no POST. Missing inline weight/count data remains unknown.
|
|
1332
1332
|
|
|
1333
1333
|
Every view checks a new-schema descriptive table the same way. Its
|
|
1334
|
-
semester cells
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1334
|
+
semester cells are empty script hooks, hold bare text, which becomes
|
|
1335
|
+
undated summaries, or hold grade boxes matched by filled detail rows,
|
|
1336
|
+
which become descriptive grades; any other layout fails the read. Only
|
|
1337
|
+
the all view with empty hooks adds that table's grades from the
|
|
1338
|
+
gateway: three more reads, five when there are grades. The other
|
|
1339
|
+
layouts need no extra request.
|
|
1338
1340
|
|
|
1339
1341
|
`records.corrections` links a corrected grade to its corrections by
|
|
1340
1342
|
`grade_id`, read from the page's correction brackets. Only the all view
|
|
@@ -2199,6 +2201,9 @@ class AccountClient:
|
|
|
2199
2201
|
error.kind,
|
|
2200
2202
|
)
|
|
2201
2203
|
raise
|
|
2204
|
+
# Reinsert so iteration order follows refresh time: eviction then drops
|
|
2205
|
+
# the least recently refreshed entry, not the one just read again.
|
|
2206
|
+
self._cache.pop(key, None)
|
|
2202
2207
|
self._cache[key] = (time.monotonic(), result)
|
|
2203
2208
|
if len(self._cache) > ACCOUNT_RESULT_CACHE_SIZE:
|
|
2204
2209
|
del self._cache[next(iter(self._cache))]
|
|
@@ -2587,6 +2592,7 @@ class AccountClient:
|
|
|
2587
2592
|
reference=identifier,
|
|
2588
2593
|
content_type=JSON,
|
|
2589
2594
|
)
|
|
2595
|
+
self._metadata.pop(key, None) # refresh order, as in _cached
|
|
2590
2596
|
self._metadata[key] = time.monotonic(), value
|
|
2591
2597
|
if len(self._metadata) > ATTENDANCE_METADATA_CACHE_SIZE:
|
|
2592
2598
|
del self._metadata[next(iter(self._metadata))]
|
|
@@ -2610,15 +2616,14 @@ class AccountClient:
|
|
|
2610
2616
|
)
|
|
2611
2617
|
except LibrusError as error:
|
|
2612
2618
|
# An unavailable or unexpected collection degrades to the original
|
|
2613
|
-
# per-reference lookups
|
|
2614
|
-
#
|
|
2619
|
+
# per-reference lookups for this call only; the next call reads the
|
|
2620
|
+
# collection again. Deadlines, budgets, cancellation and session
|
|
2621
|
+
# failures still propagate. Only parsed maps are cached.
|
|
2615
2622
|
if error.kind not in _METADATA_MAP_FALLBACK:
|
|
2616
2623
|
raise
|
|
2617
2624
|
if error.kind is ErrorKind.LIMIT:
|
|
2618
2625
|
budget.check() # An exhausted caller budget is not a large collection.
|
|
2619
|
-
|
|
2620
|
-
return MappingProxyType({})
|
|
2621
|
-
value = MappingProxyType({})
|
|
2626
|
+
return MappingProxyType({})
|
|
2622
2627
|
self._metadata_maps[endpoint] = time.monotonic(), value
|
|
2623
2628
|
return value
|
|
2624
2629
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: librus-python-api
|
|
3
|
-
Version: 1.10.
|
|
3
|
+
Version: 1.10.2
|
|
4
4
|
Summary: Independent bounded async Librus Synergia client
|
|
5
5
|
Project-URL: Repository, https://github.com/krzysztofbury/librus-python-api
|
|
6
6
|
Project-URL: Issues, https://github.com/krzysztofbury/librus-python-api/issues
|
|
@@ -42,7 +42,10 @@ private ACLs. Windows installations include `pywin32` and `tzdata` automatically
|
|
|
42
42
|
Network paths, reparse-point paths and unsafe storage permissions fail closed.
|
|
43
43
|
See [platform requirements](contracts/persistence.md#windows-disk-boundary-25).
|
|
44
44
|
|
|
45
|
-
**Status:** `1.10.
|
|
45
|
+
**Status:** `1.10.2` rejects a date whose weekday label names another
|
|
46
|
+
day and a completed-lesson cell with more than one comma, and fixes two cache
|
|
47
|
+
bugs. `1.10.1` reads descriptive grades that the new-schema table
|
|
48
|
+
shows as grade boxes. `1.10.0` returns behaviour points as a typed value
|
|
46
49
|
(`GradeRecords.behaviour_points`), reads the e-Justifications list on parent
|
|
47
50
|
logins (`AccountClient.justifications()`) and checks the gateway grade
|
|
48
51
|
pagination member recorded live.
|
|
@@ -76,7 +79,7 @@ See [limitations](#supported-features-and-limitations) below.
|
|
|
76
79
|
Install the exact release from PyPI after its gated publication completes:
|
|
77
80
|
|
|
78
81
|
```sh
|
|
79
|
-
python -m pip install librus-python-api==1.10.
|
|
82
|
+
python -m pip install librus-python-api==1.10.2
|
|
80
83
|
```
|
|
81
84
|
|
|
82
85
|
Pin the exact version qualified by your application. Before publication, use a
|
|
@@ -92,7 +95,7 @@ python -m pip install .
|
|
|
92
95
|
To install a locally built wheel instead:
|
|
93
96
|
|
|
94
97
|
```sh
|
|
95
|
-
python -m pip install ./dist/librus_python_api-1.10.
|
|
98
|
+
python -m pip install ./dist/librus_python_api-1.10.2-py3-none-any.whl
|
|
96
99
|
```
|
|
97
100
|
|
|
98
101
|
No console script or background process is installed: import the library in your
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
librus_python_api/__init__.py,sha256=
|
|
1
|
+
librus_python_api/__init__.py,sha256=mpHAI6zJzjN8ZTsBcSTN_Uk3E-IxoFDAsJ_FQ4TUR-8,6846
|
|
2
2
|
librus_python_api/_notification_bootstrap.py,sha256=18nzH0doXBNaZXCz-_ckIvRrlHTWV5Mm1t5m2-5eYGI,4669
|
|
3
3
|
librus_python_api/_notification_codec.py,sha256=hU6G3zGJ5fR8wfPC6fV2OqBKs-7XpT9eRnKO3FGsTzY,13451
|
|
4
4
|
librus_python_api/_storage.py,sha256=M_6ZAzN4zs7laOdKJBRH1I2rvy3pgqYgC_MZtsd2xtM,15893
|
|
@@ -11,21 +11,21 @@ librus_python_api/attendance_frequency.py,sha256=SBhED5zuyRIHWdw4urFyTJYykb6EYB7
|
|
|
11
11
|
librus_python_api/budget.py,sha256=8fvqT7eIxyVX2P2OBG27XsYHk_HbtSS4lzuecYpHtgs,2878
|
|
12
12
|
librus_python_api/checkpoint.py,sha256=QBmG9GtpyaGRaFq-FXuGA3yR1BjuMFN9V3RTvvi_FNQ,1930
|
|
13
13
|
librus_python_api/class_free_days.py,sha256=IwoCgr-9ZgEYYQ6717s4cDpyFzbosHMzESMabXJLGqA,2422
|
|
14
|
-
librus_python_api/completed_lessons.py,sha256=
|
|
15
|
-
librus_python_api/config.py,sha256=
|
|
14
|
+
librus_python_api/completed_lessons.py,sha256=X3NygnzEVaNM53mIf8wiIWF8GHvGCI4bmI0YROdXXLs,10875
|
|
15
|
+
librus_python_api/config.py,sha256=Ft-pQL1pZqUAM_m3zRCfsWCmYr4eZruL7kAe0gSKJ0w,66148
|
|
16
16
|
librus_python_api/detail_fields.py,sha256=vDDi5sV-e30-42SF0hwAUoldiZ5wvYtb1UlLt03lBHw,1708
|
|
17
17
|
librus_python_api/diagnostics.py,sha256=SFQ3Wq6JEFOEHjRKe0-8zcCeJ8c8Eq8lIkVk2_a8IKU,19126
|
|
18
18
|
librus_python_api/exceptions.py,sha256=x8_z5UTNmuRINTK4buLYiKdYcFA2w6GZP9ZXOL-OnRU,5531
|
|
19
19
|
librus_python_api/files.py,sha256=pQBsIJyfTOZDz83ZB-5fcd-nPMcxR1HJ155h4zTHmsA,9223
|
|
20
20
|
librus_python_api/formative_grades.py,sha256=VykwtGvViZVOJMwPH3Re1RTDCHMr1_m9_xHjZyaXDIQ,6452
|
|
21
|
-
librus_python_api/gateway_grades.py,sha256=
|
|
21
|
+
librus_python_api/gateway_grades.py,sha256=gAAqh2GmMklmYFQAhNlzD6xsDCdExP5pAbmfipyNeZs,22344
|
|
22
22
|
librus_python_api/grade_parsers.py,sha256=ROfffkCP8yj5Q708TZdpp0PDTyVmoh6X7m0y2fyJcwg,11202
|
|
23
23
|
librus_python_api/grade_records.py,sha256=Kt9zwqZNQMsIovNj2Qu9Y6oRGEqRXw-1T1X2PpkNbeY,31650
|
|
24
24
|
librus_python_api/homework_range.py,sha256=erYfvS6PhHU5XhnR6LkiLNy677hGVflY3UAuHOs-YUw,1663
|
|
25
25
|
librus_python_api/inspect_page.py,sha256=uSFJRcEd5m36kqqP6kf2uowB4x2RGNqyfnmaakVzL94,5938
|
|
26
26
|
librus_python_api/justifications.py,sha256=ZzfeZR5TvYyArQ5Oqi6VM5JmBKS2lZok4UR7hc3dI4o,7799
|
|
27
27
|
librus_python_api/lifecycle.py,sha256=XzA5CEdZFo7iL5IMUrawnRvf2m9BFe0OseP-fpQFaAE,856
|
|
28
|
-
librus_python_api/markup.py,sha256=
|
|
28
|
+
librus_python_api/markup.py,sha256=UxZVG9cWZz8VWE--uAPLfyv1Ghcu6ZbFM6E5ysA3YLs,8041
|
|
29
29
|
librus_python_api/message_content.py,sha256=v_qoEAoaYS0_9MQBaj57i5XnC7pzv_HHWefgTt4CNyM,9043
|
|
30
30
|
librus_python_api/messages.py,sha256=K9F8XVs1SojfFpdxxLV8gx9E0g81YxEHjigDzLHmDCg,10230
|
|
31
31
|
librus_python_api/models.py,sha256=Eeg0tQhhcP5r6cfU3JpT7I9MZ1ybQR6RnklJ1mgOznI,47125
|
|
@@ -45,10 +45,10 @@ librus_python_api/scheduler.py,sha256=3JplYxqvQdFz3aKXcoQUJHE9s3FPw_xRhQ2CPNLuQm
|
|
|
45
45
|
librus_python_api/school_reads.py,sha256=YHta7DmhjS5vSa4Djq8pzp01-2jhVfGOo1Mnc738rV4,15209
|
|
46
46
|
librus_python_api/school_year_archive.py,sha256=D0A1ywMKgoYgvi-d70__SFreMGvMb_72870Akkbb_m8,15492
|
|
47
47
|
librus_python_api/sending.py,sha256=Nvvk2r-6D6Us53a2fH5GW9PcA6bWEfuOvy6c3M5QVcE,4549
|
|
48
|
-
librus_python_api/service.py,sha256=
|
|
48
|
+
librus_python_api/service.py,sha256=0RQZW_jPwh8VJNphJ0NUcdeYR2VpZ30MQKns_12BsxU,105678
|
|
49
49
|
librus_python_api/timetable.py,sha256=tX1QK9fQABxzfLaHHqTe8e6rAgdOkCoTOfAHdPwNmLE,9836
|
|
50
50
|
librus_python_api/transport.py,sha256=yF-DnFy4xGYS_RWQ9161b9WJXOlYF8cFRgdjXmVVUIk,34988
|
|
51
|
-
librus_python_api-1.10.
|
|
52
|
-
librus_python_api-1.10.
|
|
53
|
-
librus_python_api-1.10.
|
|
54
|
-
librus_python_api-1.10.
|
|
51
|
+
librus_python_api-1.10.2.dist-info/METADATA,sha256=ZYvel3prhVpM6ltwnf3cI2tjGkhbCGDPHE0IezmX2zM,15286
|
|
52
|
+
librus_python_api-1.10.2.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
53
|
+
librus_python_api-1.10.2.dist-info/licenses/LICENSE,sha256=IuerLb3cnZCsaB23znydjjvKqP-LmSJd3syKa9NGUts,1071
|
|
54
|
+
librus_python_api-1.10.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|