librus-python-api 1.12.0__py3-none-any.whl → 1.13.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 +3 -1
- librus_python_api/attendance_frequency.py +0 -1
- librus_python_api/config.py +15 -4
- librus_python_api/diagnostics.py +0 -1
- librus_python_api/grade_detail.py +56 -0
- librus_python_api/grade_records.py +1 -1
- librus_python_api/justifications.py +4 -0
- librus_python_api/markup.py +0 -1
- librus_python_api/models.py +45 -0
- librus_python_api/school_year_archive.py +34 -21
- librus_python_api/service.py +33 -9
- {librus_python_api-1.12.0.dist-info → librus_python_api-1.13.2.dist-info}/METADATA +23 -4
- {librus_python_api-1.12.0.dist-info → librus_python_api-1.13.2.dist-info}/RECORD +15 -14
- {librus_python_api-1.12.0.dist-info → librus_python_api-1.13.2.dist-info}/WHEEL +0 -0
- {librus_python_api-1.12.0.dist-info → librus_python_api-1.13.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.
|
|
4
|
+
__version__ = "1.13.2"
|
|
5
5
|
|
|
6
6
|
from librus_python_api.attachments import AttachmentStream, ModernAttachmentStream
|
|
7
7
|
from librus_python_api.budget import RequestBudget
|
|
@@ -56,6 +56,7 @@ from librus_python_api.models import (
|
|
|
56
56
|
GatewayAttendance,
|
|
57
57
|
GatewayAttendanceRecord,
|
|
58
58
|
GradeCorrection,
|
|
59
|
+
GradeDetail,
|
|
59
60
|
GradeKind,
|
|
60
61
|
GradeRecords,
|
|
61
62
|
Grades,
|
|
@@ -267,6 +268,7 @@ __all__ = [
|
|
|
267
268
|
"BehaviourPointEntry",
|
|
268
269
|
"BehaviourPoints",
|
|
269
270
|
"GradeCorrection",
|
|
271
|
+
"GradeDetail",
|
|
270
272
|
"GradeKind",
|
|
271
273
|
"GradeRecords",
|
|
272
274
|
"Grades",
|
|
@@ -88,7 +88,6 @@ def _collection[M: BaseModel](data: object, key: str, maximum: int, wire: type[M
|
|
|
88
88
|
def _unique(pairs: list[tuple[str, str]]) -> dict[str, str]:
|
|
89
89
|
result: dict[str, str] = {}
|
|
90
90
|
for identifier, value in pairs:
|
|
91
|
-
# Conflicting rows are never resolved by choosing one of them.
|
|
92
91
|
if identifier in result and result[identifier] != value:
|
|
93
92
|
raise LibrusError(ErrorKind.PARSE)
|
|
94
93
|
result[identifier] = value
|
librus_python_api/config.py
CHANGED
|
@@ -434,6 +434,14 @@ ENDPOINTS: Mapping[str, Endpoint] = MappingProxyType(
|
|
|
434
434
|
False,
|
|
435
435
|
Evidence.INDEPENDENTLY_OBSERVED,
|
|
436
436
|
),
|
|
437
|
+
Endpoint(
|
|
438
|
+
"grade_detail",
|
|
439
|
+
"GET",
|
|
440
|
+
"/przegladaj_oceny/szczegoly/{id}",
|
|
441
|
+
SideEffect.NONE,
|
|
442
|
+
True,
|
|
443
|
+
Evidence.INDEPENDENTLY_OBSERVED,
|
|
444
|
+
),
|
|
437
445
|
# Gateway reads behind the grades page's new-schema descriptive
|
|
438
446
|
# table. Routes and field names come from public client code and the
|
|
439
447
|
# official page script; one authorized read parsed four records.
|
|
@@ -858,7 +866,6 @@ DESCRIPTIVE_IDENTIFIER = re.compile(r"[A-Za-z0-9_-]{1,128}")
|
|
|
858
866
|
DESCRIPTIVE_IDENTIFIER_OPERATIONS = frozenset(
|
|
859
867
|
{"descriptive_user_info", "descriptive_partial_grades"}
|
|
860
868
|
)
|
|
861
|
-
# The PartialGrades read is a POST whose only body is this fixed JSON object.
|
|
862
869
|
DESCRIPTIVE_PARTIAL_GRADES_BODY = b"{}"
|
|
863
870
|
DESCRIPTIVE_MAX_SUBJECTS = 1024
|
|
864
871
|
DESCRIPTIVE_MAX_USERS = 8192
|
|
@@ -935,10 +942,14 @@ BEHAVIOUR_POINT_LABELS = frozenset(
|
|
|
935
942
|
)
|
|
936
943
|
# Recognition only: point-grade detail links are classified, never requested.
|
|
937
944
|
POINT_GRADE_DETAIL_PATH_PREFIX = "/przegladaj_oceny_punktowe/szczegoly/"
|
|
938
|
-
#
|
|
939
|
-
# ID (librus-mcp#88); the page is never requested. Formative links share this
|
|
940
|
-
# prefix but have no digits-only rest, so they never yield a grade ID.
|
|
945
|
+
# Why: a grade's stable ID (librus-mcp#88); formative links never yield one.
|
|
941
946
|
GRADE_DETAIL_PATH_PREFIX = "/przegladaj_oceny/szczegoly/"
|
|
947
|
+
GRADE_DETAIL_TABLE_CLASSES = frozenset({"decorated", "medium", "center"})
|
|
948
|
+
GRADE_DETAIL_MAX_FIELDS = 32
|
|
949
|
+
# Why: a detail comment is the full text the tooltip cuts at ~100 characters.
|
|
950
|
+
GRADE_DETAIL_MAX_VALUE_LENGTH = 16384
|
|
951
|
+
GRADE_DETAIL_REQUIRED_LABEL = "Ocena"
|
|
952
|
+
GRADE_DETAIL_COMMENT_LABEL = "Komentarz"
|
|
942
953
|
FORMATIVE_HEADERS = (
|
|
943
954
|
"przedmiot",
|
|
944
955
|
"ocena kształtująca",
|
librus_python_api/diagnostics.py
CHANGED
|
@@ -560,7 +560,6 @@ def describe_failure(error: BaseException) -> str | None:
|
|
|
560
560
|
frame, line, elements, sequences, counts = site
|
|
561
561
|
redactor = _Redactor()
|
|
562
562
|
lines = [f"at {_site(frame, line)}"]
|
|
563
|
-
# The elements nearest the failure first; a page summary last.
|
|
564
563
|
for name, value in sorted(elements, key=lambda item: _is_page(item[1])):
|
|
565
564
|
redactor.nodes = 0
|
|
566
565
|
if _is_page(value):
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"""Bounded parser for one ordinary grade's own detail page (#225)."""
|
|
2
|
+
|
|
3
|
+
from librus_python_api import markup
|
|
4
|
+
from librus_python_api.config import (
|
|
5
|
+
GRADE_DETAIL_MAX_FIELDS,
|
|
6
|
+
GRADE_DETAIL_MAX_VALUE_LENGTH,
|
|
7
|
+
GRADE_DETAIL_REQUIRED_LABEL,
|
|
8
|
+
GRADE_DETAIL_TABLE_CLASSES,
|
|
9
|
+
)
|
|
10
|
+
from librus_python_api.exceptions import ErrorKind, LibrusError
|
|
11
|
+
from librus_python_api.parsers import parse_page
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def parse_grade_detail(body: bytes) -> tuple[tuple[str, str], ...]:
|
|
15
|
+
"""The grade's labelled fields in page order, values never shortened.
|
|
16
|
+
|
|
17
|
+
A value keeps its line breaks; an image-only value is empty. A label cell
|
|
18
|
+
is a TH, or a TD as in the correction row #40 recorded.
|
|
19
|
+
"""
|
|
20
|
+
document = parse_page(body)
|
|
21
|
+
tables = [
|
|
22
|
+
table
|
|
23
|
+
for table in document.iter("table")
|
|
24
|
+
if GRADE_DETAIL_TABLE_CLASSES <= set(table.get("class", "").split())
|
|
25
|
+
]
|
|
26
|
+
if len(tables) != 1:
|
|
27
|
+
raise LibrusError(ErrorKind.PARSE)
|
|
28
|
+
rows = [
|
|
29
|
+
row
|
|
30
|
+
for row in markup.rows(tables[0])
|
|
31
|
+
if not markup.in_header(row) and next(row.iterancestors("tfoot"), None) is None
|
|
32
|
+
]
|
|
33
|
+
if len(rows) > GRADE_DETAIL_MAX_FIELDS:
|
|
34
|
+
raise LibrusError(ErrorKind.LIMIT)
|
|
35
|
+
fields: dict[str, str] = {}
|
|
36
|
+
for row in rows:
|
|
37
|
+
cells = markup.cells(row)
|
|
38
|
+
if (
|
|
39
|
+
len(cells) != 2
|
|
40
|
+
or cells[0].tag not in {"th", "td"}
|
|
41
|
+
or cells[1].tag != "td"
|
|
42
|
+
or any(
|
|
43
|
+
c.get("rowspan", "1") != "1" or c.get("colspan", "1") != "1"
|
|
44
|
+
for c in cells
|
|
45
|
+
)
|
|
46
|
+
):
|
|
47
|
+
raise LibrusError(ErrorKind.PARSE)
|
|
48
|
+
label = markup.text(cells[0]).rstrip(":")
|
|
49
|
+
if not label or label in fields:
|
|
50
|
+
raise LibrusError(ErrorKind.PARSE)
|
|
51
|
+
fields[label] = markup.text(
|
|
52
|
+
cells[1], GRADE_DETAIL_MAX_VALUE_LENGTH, multiline=True
|
|
53
|
+
)
|
|
54
|
+
if GRADE_DETAIL_REQUIRED_LABEL not in fields:
|
|
55
|
+
raise LibrusError(ErrorKind.PARSE)
|
|
56
|
+
return tuple(fields.items())
|
|
@@ -767,7 +767,7 @@ def read_grade_records(document: html.HtmlElement) -> GradeRecords:
|
|
|
767
767
|
else:
|
|
768
768
|
for row in markup.rows(table):
|
|
769
769
|
if markup.in_header(row):
|
|
770
|
-
#
|
|
770
|
+
# Why: the header row has a subject row's shape ("Przedmiot").
|
|
771
771
|
continue
|
|
772
772
|
cells = markup.cells(row)
|
|
773
773
|
if _descriptive_row(cells):
|
|
@@ -29,6 +29,7 @@ _RANGE = re.compile(rf"od {_DAY} do {_DAY}")
|
|
|
29
29
|
# "lekcja" (one lesson) and "lekcje" were observed; "lekcji" is Polish for
|
|
30
30
|
# five or more and is accepted with them.
|
|
31
31
|
_ONE_DAY = re.compile(rf"{_DAY}, lekcj[aei]: ([0-9]{{1,2}}(?:, [0-9]{{1,2}})*)")
|
|
32
|
+
_BARE_DAY = re.compile(_DAY)
|
|
32
33
|
_SENT = re.compile(rf"{_DAY} ([0-9]{{2}}:[0-9]{{2}}:[0-9]{{2}})")
|
|
33
34
|
_STATUS = re.compile(r"(\S+)(?: \((.+)\))?")
|
|
34
35
|
|
|
@@ -103,6 +104,9 @@ def _period(text: str) -> tuple[date, date, tuple[int, ...]]:
|
|
|
103
104
|
if start > end:
|
|
104
105
|
raise _fail()
|
|
105
106
|
return start, end, ()
|
|
107
|
+
if _BARE_DAY.fullmatch(text):
|
|
108
|
+
day = _day(text)
|
|
109
|
+
return day, day, ()
|
|
106
110
|
match = _ONE_DAY.fullmatch(text)
|
|
107
111
|
if not match:
|
|
108
112
|
raise _fail()
|
librus_python_api/markup.py
CHANGED
|
@@ -150,7 +150,6 @@ def tooltip_fields(
|
|
|
150
150
|
result[last] = f"{result[last]}\n{rendered}".strip()
|
|
151
151
|
continue
|
|
152
152
|
if separator and key in result and key in TOOLTIP_REPEATABLE_LABELS:
|
|
153
|
-
# Each repeat keeps its value, in order, as one more line.
|
|
154
153
|
result[key] = f"{result[key]}\n{value}"
|
|
155
154
|
last = key
|
|
156
155
|
continue
|
librus_python_api/models.py
CHANGED
|
@@ -23,6 +23,7 @@ type OperationName = Literal[
|
|
|
23
23
|
"grades",
|
|
24
24
|
"attendance",
|
|
25
25
|
"attendance_detail",
|
|
26
|
+
"grade_detail",
|
|
26
27
|
"gateway_attendance",
|
|
27
28
|
"subject_frequency",
|
|
28
29
|
"timetable",
|
|
@@ -1064,6 +1065,10 @@ class FinalGrades:
|
|
|
1064
1065
|
observation: Observation
|
|
1065
1066
|
|
|
1066
1067
|
|
|
1068
|
+
def _shortened(comment: str | None) -> bool:
|
|
1069
|
+
return comment is not None and comment.rstrip().endswith(("\u2026", "..."))
|
|
1070
|
+
|
|
1071
|
+
|
|
1067
1072
|
@dataclass(frozen=True, slots=True)
|
|
1068
1073
|
class NumericGrade:
|
|
1069
1074
|
"""A school grade symbol, not an invented numeric conversion.
|
|
@@ -1125,6 +1130,16 @@ class NumericGrade:
|
|
|
1125
1130
|
|
|
1126
1131
|
return detail_id(self.href, GRADE_DETAIL_PATH_PREFIX)
|
|
1127
1132
|
|
|
1133
|
+
@property
|
|
1134
|
+
def comment_truncated(self) -> bool:
|
|
1135
|
+
"""Whether `comment` is a shortened tooltip comment, ending in an ellipsis.
|
|
1136
|
+
|
|
1137
|
+
The list tooltip cuts long comments to about 100 characters;
|
|
1138
|
+
`grade_detail(grade_id)` gives the full text. Computed for the same
|
|
1139
|
+
identity reason as `formative_id`.
|
|
1140
|
+
"""
|
|
1141
|
+
return _shortened(self.comment)
|
|
1142
|
+
|
|
1128
1143
|
|
|
1129
1144
|
@dataclass(frozen=True, slots=True)
|
|
1130
1145
|
class DescriptiveGrade:
|
|
@@ -1162,6 +1177,16 @@ class DescriptiveGrade:
|
|
|
1162
1177
|
|
|
1163
1178
|
return detail_id(self.href, GRADE_DETAIL_PATH_PREFIX)
|
|
1164
1179
|
|
|
1180
|
+
@property
|
|
1181
|
+
def comment_truncated(self) -> bool:
|
|
1182
|
+
"""Whether `comment` is a shortened tooltip comment, ending in an ellipsis.
|
|
1183
|
+
|
|
1184
|
+
The list tooltip cuts long comments to about 100 characters;
|
|
1185
|
+
`grade_detail(grade_id)` gives the full text. Computed for the same
|
|
1186
|
+
identity reason as `formative_id`.
|
|
1187
|
+
"""
|
|
1188
|
+
return _shortened(self.comment)
|
|
1189
|
+
|
|
1165
1190
|
|
|
1166
1191
|
@dataclass(frozen=True, slots=True)
|
|
1167
1192
|
class SchoolAverage:
|
|
@@ -1287,6 +1312,26 @@ class GradeWindow:
|
|
|
1287
1312
|
behaviour_points: tuple[BehaviourPoints, ...] = field(default=(), repr=False)
|
|
1288
1313
|
|
|
1289
1314
|
|
|
1315
|
+
@dataclass(frozen=True, slots=True)
|
|
1316
|
+
class GradeDetail:
|
|
1317
|
+
"""One ordinary grade's own detail page: labelled fields in page order.
|
|
1318
|
+
|
|
1319
|
+
Read on demand only; `grades()` never requests it.
|
|
1320
|
+
"""
|
|
1321
|
+
|
|
1322
|
+
identity: Identity
|
|
1323
|
+
grade_id: str = field(repr=False)
|
|
1324
|
+
fields: tuple[tuple[str, str], ...] = field(repr=False)
|
|
1325
|
+
observation: Observation
|
|
1326
|
+
|
|
1327
|
+
@property
|
|
1328
|
+
def comment(self) -> str | None:
|
|
1329
|
+
"""The full `Komentarz` text with its line breaks; None when absent or empty."""
|
|
1330
|
+
from librus_python_api.config import GRADE_DETAIL_COMMENT_LABEL
|
|
1331
|
+
|
|
1332
|
+
return dict(self.fields).get(GRADE_DETAIL_COMMENT_LABEL) or None
|
|
1333
|
+
|
|
1334
|
+
|
|
1290
1335
|
@dataclass(frozen=True, slots=True)
|
|
1291
1336
|
class AttendanceRecord:
|
|
1292
1337
|
symbol: str = field(repr=False)
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
structural observation; every fixture is synthetic.
|
|
3
3
|
|
|
4
4
|
One table holds every earlier school year: a year header row, a period row,
|
|
5
|
-
grade rows (subject marks or full-year descriptive text),
|
|
6
|
-
behaviour section, one absences section and an empty footer,
|
|
5
|
+
grade rows (per year, three subject marks or one full-year descriptive text),
|
|
6
|
+
then exactly one behaviour section, one absences section and an empty footer,
|
|
7
|
+
in that order.
|
|
7
8
|
A separate table lists achievements. Unknown layouts are unsupported;
|
|
8
9
|
contradictions inside the known layout are parse errors. The student's name in
|
|
9
10
|
the page header and the chart scripts are never read.
|
|
@@ -170,8 +171,8 @@ class _Body:
|
|
|
170
171
|
self.text = text
|
|
171
172
|
self.state = "grades"
|
|
172
173
|
self.labels: set[str] = set()
|
|
173
|
-
self.subjects: list[tuple[str,
|
|
174
|
-
self.descriptive: list[tuple[str,
|
|
174
|
+
self.subjects: list[tuple[str, dict[int, ArchiveMarks]]] = []
|
|
175
|
+
self.descriptive: list[tuple[str, dict[int, str]]] = []
|
|
175
176
|
self.behaviour: list[tuple[str, str]] = []
|
|
176
177
|
self.absences: dict[str, list[ArchiveCounts]] = {}
|
|
177
178
|
|
|
@@ -230,25 +231,33 @@ class _Body:
|
|
|
230
231
|
label = self._label(cells)
|
|
231
232
|
if not label:
|
|
232
233
|
_fail(ErrorKind.UNSUPPORTED_CAPABILITY)
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
]
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
234
|
+
marks: dict[int, ArchiveMarks] = {}
|
|
235
|
+
texts: dict[int, str] = {}
|
|
236
|
+
rest = list(zip(cells[1:], spans[1:], strict=True))
|
|
237
|
+
for year in range(self.count):
|
|
238
|
+
if rest and rest[0][1] == 3:
|
|
239
|
+
(cell, _), *rest = rest
|
|
240
|
+
texts[year] = self._values(
|
|
241
|
+
[cell], multiline=True, limit=ARCHIVE_MAX_TEXT_LENGTH
|
|
242
|
+
)[0]
|
|
243
|
+
elif [pair[1] for pair in rest[:3]] == [1, 1, 1]:
|
|
244
|
+
marks[year] = ArchiveMarks(*self._values([c for c, _ in rest[:3]]))
|
|
245
|
+
rest = rest[3:]
|
|
246
|
+
else:
|
|
247
|
+
_fail(ErrorKind.UNSUPPORTED_CAPABILITY)
|
|
248
|
+
if rest:
|
|
247
249
|
_fail(ErrorKind.UNSUPPORTED_CAPABILITY)
|
|
248
250
|
if label in self.labels:
|
|
249
251
|
_fail(ErrorKind.PARSE)
|
|
250
252
|
self.labels.add(label)
|
|
251
|
-
if
|
|
253
|
+
if marks:
|
|
254
|
+
self.subjects.append((label, marks))
|
|
255
|
+
if texts:
|
|
256
|
+
self.descriptive.append((label, texts))
|
|
257
|
+
if (
|
|
258
|
+
len(self.subjects) > ARCHIVE_MAX_SUBJECTS
|
|
259
|
+
or len(self.descriptive) > ARCHIVE_MAX_DESCRIPTIVE
|
|
260
|
+
):
|
|
252
261
|
_fail(ErrorKind.LIMIT)
|
|
253
262
|
|
|
254
263
|
def _behaviour(
|
|
@@ -299,10 +308,14 @@ def _archive(table: html.HtmlElement, text: _Text) -> tuple[ArchiveYear, ...]:
|
|
|
299
308
|
school_year=school_year,
|
|
300
309
|
first_year=first_year,
|
|
301
310
|
subjects=tuple(
|
|
302
|
-
ArchiveSubject(label, marks[i])
|
|
311
|
+
ArchiveSubject(label, marks[i])
|
|
312
|
+
for label, marks in body.subjects
|
|
313
|
+
if i in marks
|
|
303
314
|
),
|
|
304
315
|
descriptive=tuple(
|
|
305
|
-
ArchiveDescriptive(label, texts[i])
|
|
316
|
+
ArchiveDescriptive(label, texts[i])
|
|
317
|
+
for label, texts in body.descriptive
|
|
318
|
+
if i in texts
|
|
306
319
|
),
|
|
307
320
|
behaviour_first_semester=body.behaviour[i][0],
|
|
308
321
|
behaviour_second_semester_and_year_end=body.behaviour[i][1],
|
librus_python_api/service.py
CHANGED
|
@@ -91,6 +91,7 @@ from librus_python_api.gateway_grades import (
|
|
|
91
91
|
parse_token_info,
|
|
92
92
|
parse_user_info,
|
|
93
93
|
)
|
|
94
|
+
from librus_python_api.grade_detail import parse_grade_detail
|
|
94
95
|
from librus_python_api.grade_parsers import parse_final_grades
|
|
95
96
|
from librus_python_api.homework_range import HomeworkAccumulator
|
|
96
97
|
from librus_python_api.justifications import parse_justifications
|
|
@@ -116,6 +117,7 @@ from librus_python_api.models import (
|
|
|
116
117
|
FinalGrades,
|
|
117
118
|
GatewayAttendance,
|
|
118
119
|
GatewayAttendanceRecord,
|
|
120
|
+
GradeDetail,
|
|
119
121
|
GradeRecords,
|
|
120
122
|
Grades,
|
|
121
123
|
GradeView,
|
|
@@ -622,7 +624,6 @@ class AccountClient:
|
|
|
622
624
|
self, *, budget: RequestBudget | None = None, max_age_seconds: float = 0.0
|
|
623
625
|
) -> ModernIdentity:
|
|
624
626
|
async def fetch(budget: RequestBudget, _: bool) -> ModernIdentity:
|
|
625
|
-
# Identity reads are fresh even if a modern session is already bound.
|
|
626
627
|
account = await self._modern_ready(budget, refresh=True)
|
|
627
628
|
return ModernIdentity(
|
|
628
629
|
self._session_identity(), account, self._observation("modern_identity")
|
|
@@ -1082,8 +1083,6 @@ class AccountClient:
|
|
|
1082
1083
|
deadline=deadline,
|
|
1083
1084
|
)
|
|
1084
1085
|
|
|
1085
|
-
# Public reads: validate input, then describe one fetch for _read.
|
|
1086
|
-
|
|
1087
1086
|
async def notification_counts(
|
|
1088
1087
|
self, *, budget: RequestBudget | None = None, max_age_seconds: float = 0.0
|
|
1089
1088
|
) -> NotificationCounts:
|
|
@@ -1436,6 +1435,37 @@ class AccountClient:
|
|
|
1436
1435
|
),
|
|
1437
1436
|
)
|
|
1438
1437
|
|
|
1438
|
+
async def grade_detail(
|
|
1439
|
+
self,
|
|
1440
|
+
grade_id: str,
|
|
1441
|
+
*,
|
|
1442
|
+
budget: RequestBudget | None = None,
|
|
1443
|
+
max_age_seconds: float = 0.0,
|
|
1444
|
+
) -> GradeDetail:
|
|
1445
|
+
"""Read one ordinary grade's own detail page by its numeric `grade_id`.
|
|
1446
|
+
|
|
1447
|
+
Its `Komentarz` is the full comment that the grades list tooltip cuts
|
|
1448
|
+
to about 100 characters (`comment_truncated`). One GET per call; the
|
|
1449
|
+
grades read never requests it.
|
|
1450
|
+
"""
|
|
1451
|
+
if type(grade_id) is not str or not NUMERIC_ID.fullmatch(grade_id):
|
|
1452
|
+
raise LibrusError(ErrorKind.INVALID_INPUT)
|
|
1453
|
+
|
|
1454
|
+
async def fetch(budget: RequestBudget, _: bool) -> GradeDetail:
|
|
1455
|
+
fields = await self._page(
|
|
1456
|
+
"grade_detail", budget, parse_grade_detail, reference=grade_id
|
|
1457
|
+
)
|
|
1458
|
+
return GradeDetail(
|
|
1459
|
+
self._session_identity(),
|
|
1460
|
+
grade_id,
|
|
1461
|
+
fields,
|
|
1462
|
+
self._observation("grade_detail"),
|
|
1463
|
+
)
|
|
1464
|
+
|
|
1465
|
+
return await self._read(
|
|
1466
|
+
("grade_detail", grade_id), fetch, budget, max_age_seconds
|
|
1467
|
+
)
|
|
1468
|
+
|
|
1439
1469
|
async def class_free_days(
|
|
1440
1470
|
self,
|
|
1441
1471
|
*,
|
|
@@ -2049,8 +2079,6 @@ class AccountClient:
|
|
|
2049
2079
|
("recipients", "choices", group.identifier), fetch, budget, max_age_seconds
|
|
2050
2080
|
)
|
|
2051
2081
|
|
|
2052
|
-
# Shared read machinery.
|
|
2053
|
-
|
|
2054
2082
|
async def _school_detail(
|
|
2055
2083
|
self,
|
|
2056
2084
|
operation: Literal["agenda_detail", "homework_detail"],
|
|
@@ -2390,8 +2418,6 @@ class AccountClient:
|
|
|
2390
2418
|
def _observation(self, source: str) -> Observation:
|
|
2391
2419
|
return Observation(self._alias, datetime.now(UTC), self._generation, source)
|
|
2392
2420
|
|
|
2393
|
-
# Multi-request reads.
|
|
2394
|
-
|
|
2395
2421
|
async def _message_page(
|
|
2396
2422
|
self, folder: MessageFolder, page: int, budget: RequestBudget
|
|
2397
2423
|
) -> MessagesPage:
|
|
@@ -2794,8 +2820,6 @@ class AccountClient:
|
|
|
2794
2820
|
kinds = await self._metadata_map("attendance_types", budget)
|
|
2795
2821
|
return resolve_type_kinds(rows, kinds)
|
|
2796
2822
|
|
|
2797
|
-
# Authentication and response validation.
|
|
2798
|
-
|
|
2799
2823
|
def _validate_read_response(
|
|
2800
2824
|
self, response: TransportResponse, content_type: str
|
|
2801
2825
|
) -> None:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: librus-python-api
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.13.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
|
|
@@ -36,13 +36,22 @@ Use it in personal scripts, notification services or application backends. One
|
|
|
36
36
|
service can manage multiple logins while keeping their sessions and data separate.
|
|
37
37
|
It is not an official Librus product.
|
|
38
38
|
|
|
39
|
+
> **Unofficial project.** This is an independent, private open-source project.
|
|
40
|
+
> It is not affiliated with, endorsed by or sponsored by Librus or its owner.
|
|
41
|
+
> "Librus" and "Librus Synergia" are trademarks of their owner, named here only
|
|
42
|
+
> to say which service this software works with. See
|
|
43
|
+
> [Trademarks and affiliation](#trademarks-and-affiliation).
|
|
44
|
+
|
|
39
45
|
**Requirements:** Python 3.13 or newer. Disk workflows require a trusted local
|
|
40
46
|
POSIX filesystem on Linux/macOS, or a fixed local NTFS volume on Windows with
|
|
41
47
|
private ACLs. Windows installations include `pywin32` and `tzdata` automatically.
|
|
42
48
|
Network paths, reparse-point paths and unsafe storage permissions fail closed.
|
|
43
49
|
See [platform requirements](contracts/persistence.md#windows-disk-boundary-25).
|
|
44
50
|
|
|
45
|
-
**Status:** `1.
|
|
51
|
+
**Status:** `1.13.2` reads a grade's full comment from its detail page
|
|
52
|
+
(`grade_detail`), which the grades list shortens, and e-Justifications
|
|
53
|
+
entries listed by a bare date (1.13.0 and 1.13.1 were never published). `1.12.1` reads school-year archive rows that hold marks for one
|
|
54
|
+
year and text for another. `1.12.0` resolves a school's own attendance types, counts
|
|
46
55
|
attendance whose lesson or subject cannot be resolved apart instead of failing
|
|
47
56
|
the subject frequency read, keeps grade comment lines that hold a colon as
|
|
48
57
|
text and groups repeated gateway validation errors. `1.11.5` reads gateway attendance records whose ID is not a
|
|
@@ -93,7 +102,7 @@ See [limitations](#supported-features-and-limitations) below.
|
|
|
93
102
|
Install the exact release from PyPI after its gated publication completes:
|
|
94
103
|
|
|
95
104
|
```sh
|
|
96
|
-
python -m pip install librus-python-api==1.
|
|
105
|
+
python -m pip install librus-python-api==1.13.2
|
|
97
106
|
```
|
|
98
107
|
|
|
99
108
|
Pin the exact version qualified by your application. Before publication, use a
|
|
@@ -109,7 +118,7 @@ python -m pip install .
|
|
|
109
118
|
To install a locally built wheel instead:
|
|
110
119
|
|
|
111
120
|
```sh
|
|
112
|
-
python -m pip install ./dist/librus_python_api-1.
|
|
121
|
+
python -m pip install ./dist/librus_python_api-1.13.2-py3-none-any.whl
|
|
113
122
|
```
|
|
114
123
|
|
|
115
124
|
No console script or background process is installed: import the library in your
|
|
@@ -331,6 +340,16 @@ school data to public reports.
|
|
|
331
340
|
|
|
332
341
|
MIT licensed. See [LICENSE][license].
|
|
333
342
|
|
|
343
|
+
## Trademarks and affiliation
|
|
344
|
+
|
|
345
|
+
This is an independent, private open-source project. It is not affiliated with,
|
|
346
|
+
endorsed by, sponsored by or otherwise connected to Librus or its owner, and it
|
|
347
|
+
is not an official Librus product. "Librus", "Librus Synergia" and related
|
|
348
|
+
names and logos are trademarks of their owner. They are used here only to
|
|
349
|
+
describe which service this software works with; the author claims no rights to
|
|
350
|
+
them. Use of the service through this software remains subject to the
|
|
351
|
+
service's own terms.
|
|
352
|
+
|
|
334
353
|
[api]: https://github.com/krzysztofbury/librus-python-api/blob/main/API.md
|
|
335
354
|
[upgrade]: https://github.com/krzysztofbury/librus-python-api/blob/main/contracts/account-context.md
|
|
336
355
|
[verification]: https://github.com/krzysztofbury/librus-python-api/blob/main/VERIFICATION.md
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
librus_python_api/__init__.py,sha256=
|
|
1
|
+
librus_python_api/__init__.py,sha256=RpIzudDD1U8xMA9VUpZ-PIlOG1CaHtlyGhok1rjDfHw,6882
|
|
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,28 +7,29 @@ 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=6t4flcnydfNU4Ef1txL4JrVczcrwvHjiGQsSa1KSFwk,5829
|
|
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=PPPA5YvbJ4rH7xTgvcNetOg7aHyDaGaQBDinMUjRILU,68486
|
|
16
16
|
librus_python_api/detail_fields.py,sha256=vDDi5sV-e30-42SF0hwAUoldiZ5wvYtb1UlLt03lBHw,1708
|
|
17
|
-
librus_python_api/diagnostics.py,sha256=
|
|
17
|
+
librus_python_api/diagnostics.py,sha256=kPo1Xgwnm2lxsxcl4XbhwQQGdBRYFDwpBbK-rf81RTQ,21918
|
|
18
18
|
librus_python_api/exceptions.py,sha256=lymPWTInw_ZBPXWftyHtolnKGfeY2Z4gB5WrqtAVYQ4,6087
|
|
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
21
|
librus_python_api/gateway_grades.py,sha256=ILqWkkaRq120wG--h7GfFy4qFAQcuaa6LpzJOcCA2FU,22921
|
|
22
|
+
librus_python_api/grade_detail.py,sha256=Gl_iSoh6AZeT24EJndlmPNt-ziYlcBEQ9PKJB8p7-Fg,1977
|
|
22
23
|
librus_python_api/grade_parsers.py,sha256=P7s9yOzY6gYoWJUbo_ZKjE2xZlkHyDXakbQLJOQ5a9U,12759
|
|
23
|
-
librus_python_api/grade_records.py,sha256=
|
|
24
|
+
librus_python_api/grade_records.py,sha256=IzAw5V76vAaZzq65upDguZO9ClVZQKG8JeAoaaDh7v4,31664
|
|
24
25
|
librus_python_api/homework_range.py,sha256=erYfvS6PhHU5XhnR6LkiLNy677hGVflY3UAuHOs-YUw,1663
|
|
25
26
|
librus_python_api/inspect_page.py,sha256=uSFJRcEd5m36kqqP6kf2uowB4x2RGNqyfnmaakVzL94,5938
|
|
26
|
-
librus_python_api/justifications.py,sha256=
|
|
27
|
+
librus_python_api/justifications.py,sha256=4gFkcqsfS4LH5vwA6mf5yAi5SqHlzGZOccjBBPAgSGU,7915
|
|
27
28
|
librus_python_api/lifecycle.py,sha256=XzA5CEdZFo7iL5IMUrawnRvf2m9BFe0OseP-fpQFaAE,856
|
|
28
|
-
librus_python_api/markup.py,sha256=
|
|
29
|
+
librus_python_api/markup.py,sha256=nCG6XQCAHL1tZbIJ7S_vXSgLbaKtaPYQ59YAkKb09ys,8699
|
|
29
30
|
librus_python_api/message_content.py,sha256=v_qoEAoaYS0_9MQBaj57i5XnC7pzv_HHWefgTt4CNyM,9043
|
|
30
31
|
librus_python_api/messages.py,sha256=K9F8XVs1SojfFpdxxLV8gx9E0g81YxEHjigDzLHmDCg,10230
|
|
31
|
-
librus_python_api/models.py,sha256=
|
|
32
|
+
librus_python_api/models.py,sha256=sWerNNpp96ZjnDtJEodvL2t9uiX3uovfV4AwYg8Rn-8,49326
|
|
32
33
|
librus_python_api/modern_body.py,sha256=SocXJTyGm1Q_2owzh1PE1zcCB2kqZTz1KPJ2R4yMyoc,3895
|
|
33
34
|
librus_python_api/modern_mailbox.py,sha256=2jF9UnJZ5AF6dip-GrMcv_z2kSLpp87dIpVeXk9jMzA,20600
|
|
34
35
|
librus_python_api/modern_messages.py,sha256=qt2CXtrxCZQ-jTt0aQCD6ZaPAJQZXf0BxmvacPo9B0w,10653
|
|
@@ -43,12 +44,12 @@ librus_python_api/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
43
44
|
librus_python_api/recipients.py,sha256=6GQCKo-Zjg3VFSg1J8YXcDsy_U3r6-MUS4VCvz0xdaQ,10033
|
|
44
45
|
librus_python_api/scheduler.py,sha256=3JplYxqvQdFz3aKXcoQUJHE9s3FPw_xRhQ2CPNLuQmA,10729
|
|
45
46
|
librus_python_api/school_reads.py,sha256=YHta7DmhjS5vSa4Djq8pzp01-2jhVfGOo1Mnc738rV4,15209
|
|
46
|
-
librus_python_api/school_year_archive.py,sha256=
|
|
47
|
+
librus_python_api/school_year_archive.py,sha256=TdcwtF8u3I9k6qmke2JdU3NkWIHpGieqrVcf15m6mxc,15899
|
|
47
48
|
librus_python_api/sending.py,sha256=Nvvk2r-6D6Us53a2fH5GW9PcA6bWEfuOvy6c3M5QVcE,4549
|
|
48
|
-
librus_python_api/service.py,sha256=
|
|
49
|
+
librus_python_api/service.py,sha256=QOtlksStPzF-VBaiEjTdBzm2CDRYhZMWqq_oFqvchnA,111610
|
|
49
50
|
librus_python_api/timetable.py,sha256=tX1QK9fQABxzfLaHHqTe8e6rAgdOkCoTOfAHdPwNmLE,9836
|
|
50
51
|
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.
|
|
52
|
+
librus_python_api-1.13.2.dist-info/METADATA,sha256=6J4A5GqySJUf2e8lvuugGKf5NdrKY02SQQYiCy_uYNU,17717
|
|
53
|
+
librus_python_api-1.13.2.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
54
|
+
librus_python_api-1.13.2.dist-info/licenses/LICENSE,sha256=IuerLb3cnZCsaB23znydjjvKqP-LmSJd3syKa9NGUts,1071
|
|
55
|
+
librus_python_api-1.13.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|