librus-python-api 1.11.5__py3-none-any.whl → 1.12.0__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/attendance_frequency.py +39 -0
- librus_python_api/config.py +25 -0
- librus_python_api/markup.py +11 -3
- librus_python_api/models.py +12 -0
- librus_python_api/parsers.py +20 -7
- librus_python_api/service.py +103 -27
- {librus_python_api-1.11.5.dist-info → librus_python_api-1.12.0.dist-info}/METADATA +7 -4
- {librus_python_api-1.11.5.dist-info → librus_python_api-1.12.0.dist-info}/RECORD +11 -11
- {librus_python_api-1.11.5.dist-info → librus_python_api-1.12.0.dist-info}/WHEEL +0 -0
- {librus_python_api-1.11.5.dist-info → librus_python_api-1.12.0.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.
|
|
4
|
+
__version__ = "1.12.0"
|
|
5
5
|
|
|
6
6
|
from librus_python_api.attachments import AttachmentStream, ModernAttachmentStream
|
|
7
7
|
from librus_python_api.budget import RequestBudget
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
"""Original validated gateway parsing and explicit attendance ratio policies."""
|
|
2
2
|
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from dataclasses import replace
|
|
5
|
+
|
|
3
6
|
from pydantic import BaseModel
|
|
4
7
|
|
|
5
8
|
from librus_python_api import markup
|
|
@@ -7,6 +10,8 @@ from librus_python_api.config import (
|
|
|
7
10
|
ATTENDANCE_MAX_LESSONS,
|
|
8
11
|
ATTENDANCE_MAX_RECORDS,
|
|
9
12
|
ATTENDANCE_MAX_SUBJECTS,
|
|
13
|
+
ATTENDANCE_MAX_TYPES,
|
|
14
|
+
ATTENDANCE_STANDARD_TYPE_KINDS,
|
|
10
15
|
ATTENDANCE_TYPE_KINDS,
|
|
11
16
|
)
|
|
12
17
|
from librus_python_api.exceptions import ErrorKind, LibrusError
|
|
@@ -15,6 +20,7 @@ from librus_python_api.models import (
|
|
|
15
20
|
FrequencyMeasure,
|
|
16
21
|
GatewayAttendanceRecord,
|
|
17
22
|
_AttendanceEnvelopeWire,
|
|
23
|
+
_AttendanceTypesEnvelopeWire,
|
|
18
24
|
_LessonEnvelopeWire,
|
|
19
25
|
_LessonsEnvelopeWire,
|
|
20
26
|
_SubjectEnvelopeWire,
|
|
@@ -117,6 +123,39 @@ def parse_subject_names(body: bytes) -> dict[str, str]:
|
|
|
117
123
|
)
|
|
118
124
|
|
|
119
125
|
|
|
126
|
+
def parse_attendance_types(body: bytes) -> dict[str, str]:
|
|
127
|
+
"""Map a school's own attendance type IDs to the kind of their standard type.
|
|
128
|
+
|
|
129
|
+
Types without a known standard type are omitted and stay unknown.
|
|
130
|
+
"""
|
|
131
|
+
envelope = _collection(
|
|
132
|
+
decode_json(body), "Types", ATTENDANCE_MAX_TYPES, _AttendanceTypesEnvelopeWire
|
|
133
|
+
)
|
|
134
|
+
return _unique(
|
|
135
|
+
[
|
|
136
|
+
(kind.Id, ATTENDANCE_STANDARD_TYPE_KINDS[kind.StandardType.Id])
|
|
137
|
+
for kind in envelope.Types
|
|
138
|
+
if kind.StandardType is not None
|
|
139
|
+
and kind.StandardType.Id in ATTENDANCE_STANDARD_TYPE_KINDS
|
|
140
|
+
]
|
|
141
|
+
)
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
def resolve_type_kinds(
|
|
145
|
+
rows: tuple[GatewayAttendanceRecord, ...], kinds: Mapping[str, str]
|
|
146
|
+
) -> tuple[GatewayAttendanceRecord, ...]:
|
|
147
|
+
"""Rows of an unknown type take the kind `kinds` gives their type, if any.
|
|
148
|
+
|
|
149
|
+
The fixed ATTENDANCE_TYPE_KINDS policy always wins over a school's list.
|
|
150
|
+
"""
|
|
151
|
+
return tuple(
|
|
152
|
+
replace(row, kind=AttendanceKind(kinds[row.type_id]))
|
|
153
|
+
if row.kind == "unknown" and row.type_id in kinds
|
|
154
|
+
else row
|
|
155
|
+
for row in rows
|
|
156
|
+
)
|
|
157
|
+
|
|
158
|
+
|
|
120
159
|
def summarize_frequency(
|
|
121
160
|
rows: tuple[GatewayAttendanceRecord, ...],
|
|
122
161
|
*,
|
librus_python_api/config.py
CHANGED
|
@@ -538,6 +538,17 @@ ENDPOINTS: Mapping[str, Endpoint] = MappingProxyType(
|
|
|
538
538
|
True,
|
|
539
539
|
Evidence.INDEPENDENTLY_OBSERVED,
|
|
540
540
|
),
|
|
541
|
+
# Read only when a record's type is outside ATTENDANCE_TYPE_KINDS.
|
|
542
|
+
# Shape from public client sources and a public sample (custom
|
|
543
|
+
# types name their standard type); not yet seen on an owner login.
|
|
544
|
+
Endpoint(
|
|
545
|
+
"attendance_types",
|
|
546
|
+
"GET",
|
|
547
|
+
"/gateway/api/2.0/Attendances/Types",
|
|
548
|
+
SideEffect.NONE,
|
|
549
|
+
True,
|
|
550
|
+
Evidence.SOURCE_INFORMED,
|
|
551
|
+
),
|
|
541
552
|
Endpoint(
|
|
542
553
|
"attendance_lesson",
|
|
543
554
|
"GET",
|
|
@@ -908,6 +919,7 @@ ATTENDANCE_MAX_WINDOW_DAYS = 371
|
|
|
908
919
|
# Whole-school gateway collections resolve attendance metadata in two requests.
|
|
909
920
|
ATTENDANCE_MAX_LESSONS = 4096
|
|
910
921
|
ATTENDANCE_MAX_SUBJECTS = 1024
|
|
922
|
+
ATTENDANCE_MAX_TYPES = 1024
|
|
911
923
|
# Collection recognition and detail retrieval share this central path family.
|
|
912
924
|
ATTENDANCE_DETAIL_PATH_PREFIX = "/przegladaj_nb/szczegoly/"
|
|
913
925
|
# Recognition only: formative detail links are classified, never requested.
|
|
@@ -1088,6 +1100,8 @@ PAGE_NOTICES = MappingProxyType(
|
|
|
1088
1100
|
}
|
|
1089
1101
|
)
|
|
1090
1102
|
MODULE_UNAVAILABLE_PATH = "/modul_niedostepny"
|
|
1103
|
+
# Distinct field and rule pairs a wire validation failure names.
|
|
1104
|
+
WIRE_FAILURE_GROUPS = 5
|
|
1091
1105
|
CLASS_FREE_DAYS_MAX_RECORDS = 4096
|
|
1092
1106
|
# e-Justifications list (`/eusprawiedliwienia`, structure observed on two
|
|
1093
1107
|
# parent logins on 2026-11-13). The list table's classes, its seven header
|
|
@@ -1667,6 +1681,17 @@ ATTENDANCE_TYPE_KINDS = MappingProxyType(
|
|
|
1667
1681
|
"2829": "training",
|
|
1668
1682
|
}
|
|
1669
1683
|
)
|
|
1684
|
+
# A school's own attendance type names one of the standard types it counts
|
|
1685
|
+
# as (`StandardType`); public clients map them this way (librus-mcp#136).
|
|
1686
|
+
ATTENDANCE_STANDARD_TYPE_KINDS = MappingProxyType(
|
|
1687
|
+
{
|
|
1688
|
+
"1": "absence",
|
|
1689
|
+
"2": "late",
|
|
1690
|
+
"3": "excused",
|
|
1691
|
+
"4": "exemption",
|
|
1692
|
+
"100": "present",
|
|
1693
|
+
}
|
|
1694
|
+
)
|
|
1670
1695
|
|
|
1671
1696
|
|
|
1672
1697
|
class _ValidatedConfig(BaseModel):
|
librus_python_api/markup.py
CHANGED
|
@@ -96,9 +96,10 @@ def tooltip_fields(
|
|
|
96
96
|
A free-text field may span lines; an unlabelled line after it continues
|
|
97
97
|
its value. Any other unlabelled line is an unknown layout. With `heading`,
|
|
98
98
|
the first line is taken whole, colon included, and appended to it.
|
|
99
|
-
`multiline` names the free-text labels (default `Komentarz`);
|
|
100
|
-
|
|
101
|
-
|
|
99
|
+
`multiline` names the free-text labels (default `Komentarz`); a line
|
|
100
|
+
inside one whose label is no known label (teacher text holding a colon)
|
|
101
|
+
continues it too. With `unknown_multiline`, such a line starts a field of
|
|
102
|
+
its own that is free text as well, and inside free text a line
|
|
102
103
|
starting with a known label is text unless the tooltip's closing run of
|
|
103
104
|
known-label lines begins there. Otherwise a known label such as `Data`
|
|
104
105
|
never continues. A repeatable label (`Poprawa oceny`) adds its value as
|
|
@@ -136,6 +137,13 @@ def tooltip_fields(
|
|
|
136
137
|
)
|
|
137
138
|
and (
|
|
138
139
|
not separator
|
|
140
|
+
# Teacher text holding a colon inside a labelled free-text field
|
|
141
|
+
# such as `Komentarz` (librus-mcp#136): no Librus label, so text.
|
|
142
|
+
or (
|
|
143
|
+
not unknown_multiline
|
|
144
|
+
and last in multiline
|
|
145
|
+
and key not in TOOLTIP_LABELS
|
|
146
|
+
)
|
|
139
147
|
or (unknown_multiline and index < closing and key in TOOLTIP_LABELS)
|
|
140
148
|
)
|
|
141
149
|
):
|
librus_python_api/models.py
CHANGED
|
@@ -1408,6 +1408,9 @@ class SubjectFrequencies:
|
|
|
1408
1408
|
start: date | None
|
|
1409
1409
|
end: date | None
|
|
1410
1410
|
observation: Observation
|
|
1411
|
+
# Attendance whose lesson or subject Librus could not resolve; None when
|
|
1412
|
+
# every record resolved.
|
|
1413
|
+
unresolved: FrequencyMeasure | None = None
|
|
1411
1414
|
|
|
1412
1415
|
|
|
1413
1416
|
class _NumericReferenceWire(BaseModel):
|
|
@@ -1450,6 +1453,15 @@ class _AttendanceEnvelopeWire(BaseModel):
|
|
|
1450
1453
|
Attendances: Annotated[list[_AttendanceWire], Field(max_length=2048)]
|
|
1451
1454
|
|
|
1452
1455
|
|
|
1456
|
+
class _AttendanceTypeWire(_NumericReferenceWire):
|
|
1457
|
+
StandardType: _NumericReferenceWire | None = None
|
|
1458
|
+
|
|
1459
|
+
|
|
1460
|
+
class _AttendanceTypesEnvelopeWire(BaseModel):
|
|
1461
|
+
model_config = ConfigDict(strict=True, extra="ignore", hide_input_in_errors=True)
|
|
1462
|
+
Types: list[_AttendanceTypeWire]
|
|
1463
|
+
|
|
1464
|
+
|
|
1453
1465
|
class _LessonWire(_NumericReferenceWire):
|
|
1454
1466
|
Subject: _NumericReferenceWire
|
|
1455
1467
|
|
librus_python_api/parsers.py
CHANGED
|
@@ -18,6 +18,7 @@ from librus_python_api.config import (
|
|
|
18
18
|
PROFILE_LABELS,
|
|
19
19
|
PROFILE_LUCKY_NUMBER_CLASS,
|
|
20
20
|
PROFILE_LUCKY_NUMBER_DISABLED,
|
|
21
|
+
WIRE_FAILURE_GROUPS,
|
|
21
22
|
)
|
|
22
23
|
from librus_python_api.exceptions import ErrorKind, LibrusError, ParseError
|
|
23
24
|
from librus_python_api.models import (
|
|
@@ -288,20 +289,32 @@ def wire_failure(error: ValidationError, model: type[BaseModel]) -> str:
|
|
|
288
289
|
"""Where a wire model rejected a body: field path and rule, never a value.
|
|
289
290
|
|
|
290
291
|
A path part is shown only when it is a list index or a field name of
|
|
291
|
-
`model`; anything else (such as a dict key from the body) is `?`.
|
|
292
|
+
`model`; anything else (such as a dict key from the body) is `?`. Errors
|
|
293
|
+
that differ only in a list index are one entry, `[*]` with a count, so a
|
|
294
|
+
different field is never hidden behind repeats of the first one
|
|
295
|
+
(librus-mcp#136 showed three of four errors, all the same field).
|
|
292
296
|
"""
|
|
293
297
|
names = _wire_names(model, set())
|
|
294
298
|
errors = error.errors(include_url=False, include_context=False, include_input=False)
|
|
295
|
-
|
|
296
|
-
for item in errors
|
|
297
|
-
path = ""
|
|
299
|
+
groups: dict[tuple[str, str], list[str]] = {}
|
|
300
|
+
for item in errors:
|
|
301
|
+
path = pattern = ""
|
|
298
302
|
for part in item["loc"]:
|
|
299
303
|
if type(part) is int:
|
|
300
304
|
path += f"[{part}]"
|
|
305
|
+
pattern += "[*]"
|
|
301
306
|
else:
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
307
|
+
name = ("." if path else "") + (part if part in names else "?")
|
|
308
|
+
path += name
|
|
309
|
+
pattern += name
|
|
310
|
+
groups.setdefault((pattern or "(body)", item["type"]), []).append(
|
|
311
|
+
path or "(body)"
|
|
312
|
+
)
|
|
313
|
+
shown = [
|
|
314
|
+
f"{paths[0]} {rule}" if len(paths) == 1 else f"{pattern} {rule} x{len(paths)}"
|
|
315
|
+
for (pattern, rule), paths in list(groups.items())[:WIRE_FAILURE_GROUPS]
|
|
316
|
+
]
|
|
317
|
+
more = f"; {len(errors)} errors" if len(groups) > WIRE_FAILURE_GROUPS else ""
|
|
305
318
|
return "; ".join(shown) + more
|
|
306
319
|
|
|
307
320
|
|
librus_python_api/service.py
CHANGED
|
@@ -19,11 +19,13 @@ from librus_python_api.announcements import parse_announcements
|
|
|
19
19
|
from librus_python_api.attachments import AttachmentStream, ModernAttachmentStream
|
|
20
20
|
from librus_python_api.attendance import parse_attendance, parse_attendance_detail
|
|
21
21
|
from librus_python_api.attendance_frequency import (
|
|
22
|
+
parse_attendance_types,
|
|
22
23
|
parse_gateway_attendance,
|
|
23
24
|
parse_lesson_subject,
|
|
24
25
|
parse_lesson_subjects,
|
|
25
26
|
parse_subject_name,
|
|
26
27
|
parse_subject_names,
|
|
28
|
+
resolve_type_kinds,
|
|
27
29
|
summarize_frequency,
|
|
28
30
|
)
|
|
29
31
|
from librus_python_api.budget import RequestBudget
|
|
@@ -438,6 +440,21 @@ _READ_STATUS: contextvars.ContextVar[list[int | None] | None] = contextvars.Cont
|
|
|
438
440
|
_METADATA_MAP_FALLBACK = frozenset(
|
|
439
441
|
{ErrorKind.ACCESS_DENIED, ErrorKind.CONNECTION, ErrorKind.LIMIT, ErrorKind.PARSE}
|
|
440
442
|
)
|
|
443
|
+
_METADATA_MAP_PARSERS: Mapping[str, Callable[[bytes], dict[str, str]]] = (
|
|
444
|
+
MappingProxyType(
|
|
445
|
+
{
|
|
446
|
+
"attendance_lessons": parse_lesson_subjects,
|
|
447
|
+
"attendance_subjects": parse_subject_names,
|
|
448
|
+
"attendance_types": parse_attendance_types,
|
|
449
|
+
}
|
|
450
|
+
)
|
|
451
|
+
)
|
|
452
|
+
# A single lesson or subject Librus does not give (an HTTP failure, a denial or
|
|
453
|
+
# an unexpected body): its attendance is counted as unresolved instead of
|
|
454
|
+
# failing the whole read, as public clients do. An exhausted budget stays LIMIT.
|
|
455
|
+
_UNRESOLVED_REFERENCE = frozenset(
|
|
456
|
+
{ErrorKind.ACCESS_DENIED, ErrorKind.CONNECTION, ErrorKind.PARSE}
|
|
457
|
+
)
|
|
441
458
|
|
|
442
459
|
|
|
443
460
|
class AccountClient:
|
|
@@ -1565,11 +1582,14 @@ class AccountClient:
|
|
|
1565
1582
|
self, *, budget: RequestBudget | None = None, max_age_seconds: float = 0.0
|
|
1566
1583
|
) -> GatewayAttendance:
|
|
1567
1584
|
async def fetch(budget: RequestBudget, _: bool) -> GatewayAttendance:
|
|
1568
|
-
items = await self.
|
|
1569
|
-
|
|
1585
|
+
items = await self._typed(
|
|
1586
|
+
await self._page(
|
|
1587
|
+
"gateway_attendance",
|
|
1588
|
+
budget,
|
|
1589
|
+
parse_gateway_attendance,
|
|
1590
|
+
content_type=JSON,
|
|
1591
|
+
),
|
|
1570
1592
|
budget,
|
|
1571
|
-
parse_gateway_attendance,
|
|
1572
|
-
content_type=JSON,
|
|
1573
1593
|
)
|
|
1574
1594
|
return GatewayAttendance(
|
|
1575
1595
|
self._session_identity(),
|
|
@@ -2647,11 +2667,7 @@ class AccountClient:
|
|
|
2647
2667
|
cached = self._metadata_maps.get(endpoint)
|
|
2648
2668
|
if cached and time.monotonic() - cached[0] <= ATTENDANCE_METADATA_TTL_SECONDS:
|
|
2649
2669
|
return cached[1]
|
|
2650
|
-
parser =
|
|
2651
|
-
parse_lesson_subjects
|
|
2652
|
-
if endpoint == "attendance_lessons"
|
|
2653
|
-
else parse_subject_names
|
|
2654
|
-
)
|
|
2670
|
+
parser = _METADATA_MAP_PARSERS[endpoint]
|
|
2655
2671
|
try:
|
|
2656
2672
|
value: Mapping[str, str] = MappingProxyType(
|
|
2657
2673
|
await self._page(endpoint, budget, parser, content_type=JSON)
|
|
@@ -2676,48 +2692,108 @@ class AccountClient:
|
|
|
2676
2692
|
"gateway_attendance", budget, parse_gateway_attendance, content_type=JSON
|
|
2677
2693
|
)
|
|
2678
2694
|
observed = self._observation("gateway_attendance")
|
|
2679
|
-
rows =
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2695
|
+
rows = await self._typed(
|
|
2696
|
+
tuple(
|
|
2697
|
+
r
|
|
2698
|
+
for r in collection
|
|
2699
|
+
if (start is None or r.day >= start) and (end is None or r.day <= end)
|
|
2700
|
+
),
|
|
2701
|
+
budget,
|
|
2683
2702
|
)
|
|
2684
2703
|
lessons = dict.fromkeys(row.lesson_id for row in rows)
|
|
2685
2704
|
# Two collection reads keep the request count independent of how many
|
|
2686
2705
|
# lessons and subjects a student has; the attendance row cap bounds
|
|
2687
|
-
# both (#199). References absent from a collection
|
|
2688
|
-
#
|
|
2689
|
-
# budget on lookups it cannot finish.
|
|
2706
|
+
# both (#199). References absent from a collection resolve one request
|
|
2707
|
+
# each, so fail before spending the budget on lookups it cannot finish.
|
|
2690
2708
|
lesson_map = (
|
|
2691
2709
|
await self._metadata_map("attendance_lessons", budget) if lessons else {}
|
|
2692
2710
|
)
|
|
2693
2711
|
_check_lookups(budget, self._lookups("attendance_lesson", lesson_map, lessons))
|
|
2712
|
+
failures: list[LibrusError] = []
|
|
2694
2713
|
lesson_subjects = {
|
|
2695
2714
|
lesson: lesson_map.get(lesson)
|
|
2696
|
-
or await self.
|
|
2715
|
+
or await self._reference_or_none(
|
|
2716
|
+
"attendance_lesson", lesson, budget, failures
|
|
2717
|
+
)
|
|
2697
2718
|
for lesson in lessons
|
|
2698
2719
|
}
|
|
2699
2720
|
subjects: dict[str, list[GatewayAttendanceRecord]] = {}
|
|
2721
|
+
unresolved: list[GatewayAttendanceRecord] = []
|
|
2700
2722
|
for row in rows:
|
|
2701
|
-
|
|
2723
|
+
subject = lesson_subjects[row.lesson_id]
|
|
2724
|
+
if subject is None:
|
|
2725
|
+
unresolved.append(row)
|
|
2726
|
+
else:
|
|
2727
|
+
subjects.setdefault(subject, []).append(row)
|
|
2702
2728
|
subject_map = (
|
|
2703
2729
|
await self._metadata_map("attendance_subjects", budget) if subjects else {}
|
|
2704
2730
|
)
|
|
2705
2731
|
_check_lookups(
|
|
2706
2732
|
budget, self._lookups("attendance_subject", subject_map, subjects)
|
|
2707
2733
|
)
|
|
2708
|
-
items = [
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2734
|
+
items: list[SubjectFrequency] = []
|
|
2735
|
+
for subject, records in subjects.items():
|
|
2736
|
+
name = subject_map.get(subject) or await self._reference_or_none(
|
|
2737
|
+
"attendance_subject", subject, budget, failures
|
|
2738
|
+
)
|
|
2739
|
+
if name is None:
|
|
2740
|
+
unresolved.extend(records)
|
|
2741
|
+
continue
|
|
2742
|
+
items.append(
|
|
2743
|
+
SubjectFrequency(
|
|
2744
|
+
subject,
|
|
2745
|
+
name,
|
|
2746
|
+
summarize_frequency(tuple(records), subject_policy=True),
|
|
2747
|
+
)
|
|
2714
2748
|
)
|
|
2715
|
-
|
|
2716
|
-
|
|
2749
|
+
if failures and not items:
|
|
2750
|
+
# Nothing resolved: a failing route, not a missing reference. A
|
|
2751
|
+
# successful all-unresolved result would hide it and be cached.
|
|
2752
|
+
raise failures[0]
|
|
2717
2753
|
return SubjectFrequencies(
|
|
2718
|
-
self._session_identity(),
|
|
2754
|
+
self._session_identity(),
|
|
2755
|
+
tuple(items),
|
|
2756
|
+
start,
|
|
2757
|
+
end,
|
|
2758
|
+
observed,
|
|
2759
|
+
summarize_frequency(tuple(unresolved), subject_policy=True)
|
|
2760
|
+
if unresolved
|
|
2761
|
+
else None,
|
|
2719
2762
|
)
|
|
2720
2763
|
|
|
2764
|
+
async def _reference_or_none(
|
|
2765
|
+
self,
|
|
2766
|
+
endpoint: str,
|
|
2767
|
+
identifier: str,
|
|
2768
|
+
budget: RequestBudget,
|
|
2769
|
+
failures: list[LibrusError],
|
|
2770
|
+
) -> str | None:
|
|
2771
|
+
"""A lesson's subject or a subject's name; None when Librus does not give
|
|
2772
|
+
it, with the failure appended to `failures`.
|
|
2773
|
+
|
|
2774
|
+
An expired session (401 or a login redirect), throttling, maintenance,
|
|
2775
|
+
deadlines, budgets and cancellation still propagate.
|
|
2776
|
+
"""
|
|
2777
|
+
try:
|
|
2778
|
+
return await self._metadata_value(endpoint, identifier, budget)
|
|
2779
|
+
except LibrusError as error:
|
|
2780
|
+
if error.kind not in _UNRESOLVED_REFERENCE:
|
|
2781
|
+
raise
|
|
2782
|
+
failures.append(error)
|
|
2783
|
+
return None
|
|
2784
|
+
|
|
2785
|
+
async def _typed(
|
|
2786
|
+
self, rows: tuple[GatewayAttendanceRecord, ...], budget: RequestBudget
|
|
2787
|
+
) -> tuple[GatewayAttendanceRecord, ...]:
|
|
2788
|
+
"""Resolve a school's own attendance types; one read, only when needed.
|
|
2789
|
+
|
|
2790
|
+
A type list Librus cannot give leaves those rows unknown, as before.
|
|
2791
|
+
"""
|
|
2792
|
+
if all(row.kind != "unknown" for row in rows):
|
|
2793
|
+
return rows
|
|
2794
|
+
kinds = await self._metadata_map("attendance_types", budget)
|
|
2795
|
+
return resolve_type_kinds(rows, kinds)
|
|
2796
|
+
|
|
2721
2797
|
# Authentication and response validation.
|
|
2722
2798
|
|
|
2723
2799
|
def _validate_read_response(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: librus-python-api
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.12.0
|
|
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.
|
|
45
|
+
**Status:** `1.12.0` resolves a school's own attendance types, counts
|
|
46
|
+
attendance whose lesson or subject cannot be resolved apart instead of failing
|
|
47
|
+
the subject frequency read, keeps grade comment lines that hold a colon as
|
|
48
|
+
text and groups repeated gateway validation errors. `1.11.5` reads gateway attendance records whose ID is not a
|
|
46
49
|
number and grade tooltips longer than 32 lines. `1.11.4` recovers the messages sign-in after a page that ended the
|
|
47
50
|
session, reports e-Justifications switched off for a parent login as
|
|
48
51
|
`ViewDisabledError`, reads descriptive grade skills that wrap onto a second
|
|
@@ -90,7 +93,7 @@ See [limitations](#supported-features-and-limitations) below.
|
|
|
90
93
|
Install the exact release from PyPI after its gated publication completes:
|
|
91
94
|
|
|
92
95
|
```sh
|
|
93
|
-
python -m pip install librus-python-api==1.
|
|
96
|
+
python -m pip install librus-python-api==1.12.0
|
|
94
97
|
```
|
|
95
98
|
|
|
96
99
|
Pin the exact version qualified by your application. Before publication, use a
|
|
@@ -106,7 +109,7 @@ python -m pip install .
|
|
|
106
109
|
To install a locally built wheel instead:
|
|
107
110
|
|
|
108
111
|
```sh
|
|
109
|
-
python -m pip install ./dist/librus_python_api-1.
|
|
112
|
+
python -m pip install ./dist/librus_python_api-1.12.0-py3-none-any.whl
|
|
110
113
|
```
|
|
111
114
|
|
|
112
115
|
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=G9bwNt89cbdKinH4UPl2srwm4gH7-08AofPg8cz-kak,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
|
|
@@ -7,12 +7,12 @@ librus_python_api/announcements.py,sha256=13FoOR1sq7tt9w6aLf0vclcFKDqLUiIYaO5iYD
|
|
|
7
7
|
librus_python_api/attachment_routes.py,sha256=uSg5wCQqHJiphF0KdI0GatQxZr5SLUx6xWQRsl_U4_U,4123
|
|
8
8
|
librus_python_api/attachments.py,sha256=Iq-ERZWc3gYXu6Lcv6womT2EXCc-c1Q7r_Q6VyaCm2E,10818
|
|
9
9
|
librus_python_api/attendance.py,sha256=Dq2IC8WERO-9x-LZIN5Nl0PTLYmL1Iq7BZtOz6nssOI,7428
|
|
10
|
-
librus_python_api/attendance_frequency.py,sha256=
|
|
10
|
+
librus_python_api/attendance_frequency.py,sha256=0MXLK0jY_LjL7aM22U4vK_z2mEADGzhwxDiscq5zaEY,5900
|
|
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
14
|
librus_python_api/completed_lessons.py,sha256=7TwLbUo67hbxO2Te6PzRfe7UzP94P1eRqfbttn9S3KA,11139
|
|
15
|
-
librus_python_api/config.py,sha256=
|
|
15
|
+
librus_python_api/config.py,sha256=ntL1zEl6KwTCFOifUKI3nAbD-uOtelNUB9gyo69NVIM,68169
|
|
16
16
|
librus_python_api/detail_fields.py,sha256=vDDi5sV-e30-42SF0hwAUoldiZ5wvYtb1UlLt03lBHw,1708
|
|
17
17
|
librus_python_api/diagnostics.py,sha256=LxcN4BwX1Bn9lk70v0CxWd23-q2H_KlyJzKC6vm2SMQ,21989
|
|
18
18
|
librus_python_api/exceptions.py,sha256=lymPWTInw_ZBPXWftyHtolnKGfeY2Z4gB5WrqtAVYQ4,6087
|
|
@@ -25,10 +25,10 @@ librus_python_api/homework_range.py,sha256=erYfvS6PhHU5XhnR6LkiLNy677hGVflY3UAuH
|
|
|
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=W_nWgsoY56-XFbW-WMTc6QyR7cBqQRA-L6qgCSYg3k4,8770
|
|
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
|
-
librus_python_api/models.py,sha256=
|
|
31
|
+
librus_python_api/models.py,sha256=v9J-5qDUPbpO_MJx-jAlq-p3OGs44mfqEhGAiv3EoSQ,47782
|
|
32
32
|
librus_python_api/modern_body.py,sha256=SocXJTyGm1Q_2owzh1PE1zcCB2kqZTz1KPJ2R4yMyoc,3895
|
|
33
33
|
librus_python_api/modern_mailbox.py,sha256=2jF9UnJZ5AF6dip-GrMcv_z2kSLpp87dIpVeXk9jMzA,20600
|
|
34
34
|
librus_python_api/modern_messages.py,sha256=qt2CXtrxCZQ-jTt0aQCD6ZaPAJQZXf0BxmvacPo9B0w,10653
|
|
@@ -36,7 +36,7 @@ librus_python_api/notification_models.py,sha256=4eLTAE9JzHhveoaWtZQwGBolmb87QUP5
|
|
|
36
36
|
librus_python_api/notification_persistence.py,sha256=8GYPbCVD0AecrC4IUXFkHkhNS-uGXkXzsuKxreTIk9I,49454
|
|
37
37
|
librus_python_api/notification_workflow.py,sha256=XpWNGWbRsqtpTJinPsw65bjnnEnNpm-qzn0QPxz43Xg,13009
|
|
38
38
|
librus_python_api/notifications.py,sha256=VbA8pqNG_19yYo9y7IqpGRmfEb4qDcvA5gBb1syGJKs,7806
|
|
39
|
-
librus_python_api/parsers.py,sha256=
|
|
39
|
+
librus_python_api/parsers.py,sha256=Xe5x2hN6fLNxAlvh8LBcfIeL15QMp258gWU1jU4rs_U,15499
|
|
40
40
|
librus_python_api/parsing.py,sha256=H71srw5yx-RFrAKZFgj-QFX-DIXZmhnGrDTmJhazCB8,1838
|
|
41
41
|
librus_python_api/persistence.py,sha256=F35yBRu6D8aYgdwKTpzVdqVTyiUaLQludUmyyskb3Vo,15529
|
|
42
42
|
librus_python_api/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -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=i1ZuvJPZBWWf4DEqhJj65UjMRGe4sNVuvdYd1u-xFdU,110681
|
|
49
49
|
librus_python_api/timetable.py,sha256=tX1QK9fQABxzfLaHHqTe8e6rAgdOkCoTOfAHdPwNmLE,9836
|
|
50
50
|
librus_python_api/transport.py,sha256=SAg-LovpilhgmBghjw0snm5DXYQPpgYazyOQzM2T1Aw,35571
|
|
51
|
-
librus_python_api-1.
|
|
52
|
-
librus_python_api-1.
|
|
53
|
-
librus_python_api-1.
|
|
54
|
-
librus_python_api-1.
|
|
51
|
+
librus_python_api-1.12.0.dist-info/METADATA,sha256=51gwU4CWXCN9aorT3cQn85XCZc0zq8Ptm-DrT0iAu_w,16560
|
|
52
|
+
librus_python_api-1.12.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
53
|
+
librus_python_api-1.12.0.dist-info/licenses/LICENSE,sha256=IuerLb3cnZCsaB23znydjjvKqP-LmSJd3syKa9NGUts,1071
|
|
54
|
+
librus_python_api-1.12.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|