minerva-zermelo 0.1.0__tar.gz
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.
- minerva_zermelo-0.1.0/.example.env +6 -0
- minerva_zermelo-0.1.0/.gitignore +26 -0
- minerva_zermelo-0.1.0/CHANGELOG.md +165 -0
- minerva_zermelo-0.1.0/DEVLOG.md +77 -0
- minerva_zermelo-0.1.0/LICENSE +19 -0
- minerva_zermelo-0.1.0/PKG-INFO +335 -0
- minerva_zermelo-0.1.0/pyproject.toml +27 -0
- minerva_zermelo-0.1.0/readme.md +296 -0
- minerva_zermelo-0.1.0/requirements.txt +4 -0
- minerva_zermelo-0.1.0/src/minerva/Blueprints/Appointment.py +109 -0
- minerva_zermelo-0.1.0/src/minerva/Blueprints/Student.py +59 -0
- minerva_zermelo-0.1.0/src/minerva/ImportData/ImportAppointments.py +202 -0
- minerva_zermelo-0.1.0/src/minerva/ImportData/ImportStudents.py +55 -0
- minerva_zermelo-0.1.0/src/minerva/ImportData/MassImportAppointments.py +103 -0
- minerva_zermelo-0.1.0/src/minerva/ImportData/ZermeloMain.py +89 -0
- minerva_zermelo-0.1.0/src/minerva/ImportData/__init__.py +0 -0
- minerva_zermelo-0.1.0/src/minerva/ZermeloApiWrapper/__init__.py +14 -0
- minerva_zermelo-0.1.0/src/minerva/ZermeloApiWrapper/asgi.py +19 -0
- minerva_zermelo-0.1.0/src/minerva/ZermeloApiWrapper/endpoints/Appointments.py +24 -0
- minerva_zermelo-0.1.0/src/minerva/ZermeloApiWrapper/endpoints/students.py +38 -0
- minerva_zermelo-0.1.0/src/minerva/ZermeloApiWrapper/middleware/api_auth.py +32 -0
- minerva_zermelo-0.1.0/src/minerva/ZermeloApiWrapper/settings.py +135 -0
- minerva_zermelo-0.1.0/src/minerva/ZermeloApiWrapper/urls.py +25 -0
- minerva_zermelo-0.1.0/src/minerva/ZermeloApiWrapper/wsgi.py +19 -0
- minerva_zermelo-0.1.0/src/minerva/__init__.py +28 -0
- minerva_zermelo-0.1.0/src/minerva/helper/__init__.py +0 -0
- minerva_zermelo-0.1.0/src/minerva/helper/api.py +95 -0
- minerva_zermelo-0.1.0/src/minerva/helper/get_api_token.py +89 -0
- minerva_zermelo-0.1.0/src/minerva/helper/log_api_message.py +22 -0
- minerva_zermelo-0.1.0/src/minerva/helper/year.py +27 -0
- minerva_zermelo-0.1.0/src/minerva/manage.py +25 -0
- minerva_zermelo-0.1.0/src/minerva/readme.md +177 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Bytecode & Caches
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# Databases
|
|
7
|
+
*.db
|
|
8
|
+
*.sqlite3
|
|
9
|
+
|
|
10
|
+
# Build & packaging artifacts
|
|
11
|
+
dist/
|
|
12
|
+
build/
|
|
13
|
+
*.egg-info/
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
# Environment
|
|
17
|
+
.env
|
|
18
|
+
.venv/
|
|
19
|
+
env/
|
|
20
|
+
|
|
21
|
+
*.json
|
|
22
|
+
test
|
|
23
|
+
__pycache__/
|
|
24
|
+
logs/
|
|
25
|
+
*.db
|
|
26
|
+
*sqlite3
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
# Project Change Log
|
|
2
|
+
|
|
3
|
+
This file records the complete committed Git history of the project in chronological order. It does not include uncommitted working-tree changes.
|
|
4
|
+
|
|
5
|
+
## 2026-10-14 - Initial project
|
|
6
|
+
|
|
7
|
+
- Created the initial `main.py` file.
|
|
8
|
+
- Commit: `098fa75` (`Init`)
|
|
9
|
+
|
|
10
|
+
## 2026-10-16 - API base
|
|
11
|
+
|
|
12
|
+
- Added the first Zermelo API client configuration.
|
|
13
|
+
- Added environment variable loading with `python-dotenv`.
|
|
14
|
+
- Added school, authorization, base URL, and request header configuration.
|
|
15
|
+
- Added the first school-year and appointment request logic.
|
|
16
|
+
- Commit: `06daec5` (`base`)
|
|
17
|
+
|
|
18
|
+
## 2026-10-16 - Data folder setup
|
|
19
|
+
|
|
20
|
+
- Added initial `.gitignore` configuration.
|
|
21
|
+
- Added a data folder reference to the project.
|
|
22
|
+
- Commit: `40a62b7` (`data folder`)
|
|
23
|
+
|
|
24
|
+
## 2026-10-18 - Base features and fixes
|
|
25
|
+
|
|
26
|
+
- Added more API functionality and fixed initial bugs.
|
|
27
|
+
- Added school-year ID and user retrieval.
|
|
28
|
+
- Expanded appointment retrieval and response handling.
|
|
29
|
+
- Commit: `9407664` (`added more base features and bug fixes`)
|
|
30
|
+
|
|
31
|
+
## 2026-10-18 - Helper module and README
|
|
32
|
+
|
|
33
|
+
- Added `helper/helper.py` for shared API configuration and school-year helpers.
|
|
34
|
+
- Refactored the main script to use helper functionality.
|
|
35
|
+
- Added the first project README.
|
|
36
|
+
- Updated `.gitignore`.
|
|
37
|
+
- Commit: `f34721a` (`added a readme`)
|
|
38
|
+
|
|
39
|
+
## 2026-10-18 - Endpoint expansion
|
|
40
|
+
|
|
41
|
+
- Created the `ImportData` package and moved the main API workflow into it.
|
|
42
|
+
- Added appointment import support.
|
|
43
|
+
- Added endpoint functions for appointments, branches, users, departments, holidays, jobs, locations, school years, time slots, and students.
|
|
44
|
+
- Added a shared endpoint request helper.
|
|
45
|
+
- Added logging and automatic creation of the `logs/messages` directories.
|
|
46
|
+
- Removed the old root `main.py` implementation.
|
|
47
|
+
- Commit: `369ea9d` (`added more enpoints`)
|
|
48
|
+
|
|
49
|
+
## 2026-10-19 - Parameterized requests
|
|
50
|
+
|
|
51
|
+
- Updated endpoint functions to accept school-year IDs, school years, and user IDs.
|
|
52
|
+
- Improved request construction and endpoint parameters.
|
|
53
|
+
- Updated helper functionality for the expanded endpoint workflow.
|
|
54
|
+
- Commit: `279b221` (`MOREEE ENDPONTS`)
|
|
55
|
+
|
|
56
|
+
## 2026-10-20 - More API fields
|
|
57
|
+
|
|
58
|
+
- Added more appointment fields, including teachers, subjects, locations, online details, capacity, and modification information.
|
|
59
|
+
- Added student retrieval support.
|
|
60
|
+
- Improved helper and endpoint data handling.
|
|
61
|
+
- Commit: `b4ac960` (`more fields for endpoints and better helper script`)
|
|
62
|
+
|
|
63
|
+
## 2026-10-23 - Database and API wrapper
|
|
64
|
+
|
|
65
|
+
- Added SQLite-backed `Student` and `Appointment` blueprints.
|
|
66
|
+
- Added student and appointment import scripts.
|
|
67
|
+
- Added automatic Zermelo API token retrieval through Selenium and the login flow.
|
|
68
|
+
- Added school-year and API message logging helpers.
|
|
69
|
+
- Added Django project scaffolding with settings, URLs, WSGI, and ASGI entry points.
|
|
70
|
+
- Added a student API endpoint.
|
|
71
|
+
- Added `main.py` and `manage.py` for the database/API application.
|
|
72
|
+
- Updated the README and `.gitignore`.
|
|
73
|
+
- Commit: `ed3e3c5` (`added database for the students and a api wrapper`)
|
|
74
|
+
|
|
75
|
+
## 2026-10-23 - Devlog update
|
|
76
|
+
|
|
77
|
+
- Updated `DEVLOG.md` with the project history through the database and API wrapper work.
|
|
78
|
+
- Commit: `a5fab31` (`updated dev log`)
|
|
79
|
+
|
|
80
|
+
## 2026-10-25 - Mass appointment import
|
|
81
|
+
|
|
82
|
+
- Added `ImportData/MassImportAppointments.py` for importing appointments across a range of student IDs.
|
|
83
|
+
- Expanded appointment import and storage in `appointments.db`.
|
|
84
|
+
- Added shared API and school-year helpers in `helper/api.py` and `helper/year.py`.
|
|
85
|
+
- Removed duplicate older helper modules.
|
|
86
|
+
- Added `.example.env` and `requirements.txt`.
|
|
87
|
+
- Expanded the README with installation, environment, token, API, and mass-import instructions.
|
|
88
|
+
- Updated the student API route to `/api/students/`.
|
|
89
|
+
- Commit: `d641363` (`Implemented massImportAppointments`)
|
|
90
|
+
|
|
91
|
+
## 2026-10-25 - Devlog update
|
|
92
|
+
|
|
93
|
+
- Updated `.gitignore`.
|
|
94
|
+
- Added the latest mass-import work to `DEVLOG.md`.
|
|
95
|
+
- Commit: `017e0f5` (`Updated devlog`)
|
|
96
|
+
|
|
97
|
+
## 2026-10-26 - Appointment API wrapper
|
|
98
|
+
|
|
99
|
+
- Added appointments to the Django API wrapper.
|
|
100
|
+
- Added `zermeloAPI/endpoints/Appointments.py`.
|
|
101
|
+
- Expanded the students endpoint and improved student import behavior.
|
|
102
|
+
- Made small bug fixes in the import and API code.
|
|
103
|
+
- Updated URL routing for the appointment endpoint.
|
|
104
|
+
- Commit: `e4a2a49` (`some small bugfixses and add the Apointments to the api wrapper`)
|
|
105
|
+
|
|
106
|
+
## 2026-10-28 - API and authentication fixes
|
|
107
|
+
|
|
108
|
+
- Fixed appointment import and mass-import behavior.
|
|
109
|
+
- Improved school-year handling.
|
|
110
|
+
- Corrected the appointments API endpoint implementation.
|
|
111
|
+
- Added API authentication middleware.
|
|
112
|
+
- Updated Django settings for the middleware.
|
|
113
|
+
- Commit: `614557a` (`More small bugfixes`)
|
|
114
|
+
|
|
115
|
+
## 2026-10-29 - Documentation updates
|
|
116
|
+
|
|
117
|
+
- Expanded the README with more project documentation.
|
|
118
|
+
- Added an additional documentation update describing project usage and behavior.
|
|
119
|
+
- Commits: `d41e8df` (`More documentair`), `20d2381` (`More documentair`)
|
|
120
|
+
|
|
121
|
+
## 2026-10-30 - First library packaging
|
|
122
|
+
|
|
123
|
+
- Added the `pyproject.toml` package configuration.
|
|
124
|
+
- Added the `LICENSE` file.
|
|
125
|
+
- Added the first distributable package archive.
|
|
126
|
+
- Moved the project into the `scr/Minerva` package layout.
|
|
127
|
+
- Moved the API, helper, import, blueprint, and Django files into the package.
|
|
128
|
+
- Added package documentation in `scr/Minerva/readme.md`.
|
|
129
|
+
- Added and cleaned up ignored files and generated Python cache files.
|
|
130
|
+
- Commit: `6a83d1d` (`Libary test`)
|
|
131
|
+
|
|
132
|
+
## 2026-10-30 - Move to `src/minerva`
|
|
133
|
+
|
|
134
|
+
- Moved the Minerva package from `scr/Minerva` to `src/minerva`.
|
|
135
|
+
- Moved import scripts, blueprints, helpers, and Django wrapper files into the new source layout.
|
|
136
|
+
- Preserved the package contents while changing the project structure.
|
|
137
|
+
- Commit: `a7d6078` (`small fixes`)
|
|
138
|
+
|
|
139
|
+
## 2026-10-30 - Cleanup and wrapper rename
|
|
140
|
+
|
|
141
|
+
- Expanded `.gitignore` to exclude generated files and build artifacts.
|
|
142
|
+
- Removed tracked Python cache files and the old package archive.
|
|
143
|
+
- Renamed `zermeloAPI` to `ZermeloApiWrapper`.
|
|
144
|
+
- Cleaned up the old root-level structure.
|
|
145
|
+
- Commit: `b2a93b5` (`small fixes`)
|
|
146
|
+
|
|
147
|
+
## 2026-10-30 - Library refactor
|
|
148
|
+
|
|
149
|
+
- Refactored `ZermeloMain` into a reusable package API.
|
|
150
|
+
- Reworked API helper functions and request handling.
|
|
151
|
+
- Simplified the year helper.
|
|
152
|
+
- Updated package initialization and environment configuration.
|
|
153
|
+
- Removed obsolete import code.
|
|
154
|
+
- Commit: `1f607e7` (`small fixes + big refactor`)
|
|
155
|
+
|
|
156
|
+
## 2026-11-01 - Library packaging refactor
|
|
157
|
+
|
|
158
|
+
- Completed the library refactor in the `src/minerva` layout.
|
|
159
|
+
- Updated `pyproject.toml` package metadata and build configuration.
|
|
160
|
+
- Updated the README with expanded installation, usage, API, import, and library documentation.
|
|
161
|
+
- Updated import scripts and mass appointment importing for the refactored package.
|
|
162
|
+
- Updated the `ZermeloApiWrapper` Django package, authentication middleware, settings, URLs, and WSGI/ASGI files.
|
|
163
|
+
- Improved API token, API request, and school-year helper implementations.
|
|
164
|
+
- Updated `.gitignore` for the final package structure.
|
|
165
|
+
- Commit: `7de39cc` (`libary refactor`)
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Development Log
|
|
2
|
+
|
|
3
|
+
This log is based on the committed Git history of the project.
|
|
4
|
+
|
|
5
|
+
## 2026-10-14 - Initial setup
|
|
6
|
+
|
|
7
|
+
- Created the initial `main.py` file as the starting point for the project.
|
|
8
|
+
- Commit: `098fa75` (`Init`)
|
|
9
|
+
|
|
10
|
+
## 2026-10-16 - Zermelo API base
|
|
11
|
+
|
|
12
|
+
- Added the first Zermelo API client setup.
|
|
13
|
+
- Added environment variable loading with `python-dotenv`.
|
|
14
|
+
- Added configuration for the school, API authorization, base URL, and request headers.
|
|
15
|
+
- Added the first school-year lookup and appointment retrieval logic.
|
|
16
|
+
- Added `.gitignore` entries and a data directory reference.
|
|
17
|
+
- Commits: `06daec5`, `40a62b7`
|
|
18
|
+
|
|
19
|
+
## 2026-10-18 - Base features and documentation
|
|
20
|
+
|
|
21
|
+
- Added more API functionality and fixed initial bugs.
|
|
22
|
+
- Added retrieval of users and school-year IDs.
|
|
23
|
+
- Created `helper/helper.py` for shared API configuration and school-year helpers.
|
|
24
|
+
- Added the first `readme.md` with project information and setup requirements.
|
|
25
|
+
- Commit: `9407664`, `f34721a`
|
|
26
|
+
|
|
27
|
+
## 2026-10-18 - ImportData structure and endpoint expansion
|
|
28
|
+
|
|
29
|
+
- Reorganized the application into the `ImportData` package.
|
|
30
|
+
- Added `ImportData/ZermeloMain.py` as the main API module.
|
|
31
|
+
- Added `ImportData/ImportAppointments.py` as the appointment import entry point.
|
|
32
|
+
- Added package initialization files for `ImportData` and `helper`.
|
|
33
|
+
- Replaced the original root `main.py` implementation with the new package structure.
|
|
34
|
+
- Added logging and automatic creation of `logs/messages` directories.
|
|
35
|
+
- Added endpoint functions for appointments, branches, users, departments, holidays, jobs, locations, school years, time slots, and students.
|
|
36
|
+
- Added a shared endpoint request helper.
|
|
37
|
+
- Commit: `369ea9d` (`added more enpoints`)
|
|
38
|
+
|
|
39
|
+
## 2026-10-19 - Parameterized endpoint requests
|
|
40
|
+
|
|
41
|
+
- Updated endpoint functions to accept school-year IDs, school years, and user IDs where needed.
|
|
42
|
+
- Improved request construction through the shared endpoint helper.
|
|
43
|
+
- Updated helper code to support the expanded endpoint workflow.
|
|
44
|
+
- Commit: `279b221` (`MOREEE ENDPONTS`)
|
|
45
|
+
|
|
46
|
+
## 2026-10-20 - More fields and student retrieval
|
|
47
|
+
|
|
48
|
+
- Added more appointment response fields, including teachers, subjects, locations, online details, capacity, and modification information.
|
|
49
|
+
- Added a student retrieval function.
|
|
50
|
+
- Improved the helper script and endpoint data handling.
|
|
51
|
+
- Commit: `b4ac960` (`more fields for endpoints and better helper script`)
|
|
52
|
+
|
|
53
|
+
## 2026-10-21 - Added dev log
|
|
54
|
+
- Added a dev log file
|
|
55
|
+
|
|
56
|
+
## 2026-10-23 - Database and API wrapper
|
|
57
|
+
|
|
58
|
+
- Added SQLite-backed student and appointment data models through the `Blueprints` modules.
|
|
59
|
+
- Added student and appointment import scripts that fetch API data and store it in the local database.
|
|
60
|
+
- Added a Selenium-based helper for obtaining the Zermelo API authorization token through the login flow.
|
|
61
|
+
- Added a helper for retrieving school-year IDs and a helper for logging API messages.
|
|
62
|
+
- Refactored the API helper functions and expanded the import workflow.
|
|
63
|
+
- Added Django project scaffolding, including settings, URL configuration, WSGI/ASGI entry points, and a student API endpoint.
|
|
64
|
+
- Added a root `main.py` and `manage.py` for the database/API application.
|
|
65
|
+
- Updated the README and `.gitignore` for the new project structure.
|
|
66
|
+
- Commit: `ed3e3c5` (`added database for the students and a api wrapper`)
|
|
67
|
+
|
|
68
|
+
## 2026-10-25 - Mass appointment import
|
|
69
|
+
|
|
70
|
+
- Added `ImportData/MassImportAppointments.py` to import appointments for a range of student IDs.
|
|
71
|
+
- Expanded the appointment importer to fetch, convert, and store appointment data in `appointments.db`.
|
|
72
|
+
- Added shared API and school-year helpers in `helper/api.py` and `helper/year.py`.
|
|
73
|
+
- Removed the older duplicate helper modules and moved their functionality into the new helpers.
|
|
74
|
+
- Added an `.example.env` file and a `requirements.txt` file for setup and dependencies.
|
|
75
|
+
- Expanded the README with installation instructions, environment configuration, token setup, and mass-import usage.
|
|
76
|
+
- Updated the student API route to `/api/students/`.
|
|
77
|
+
- Commit: `d641363` (`Implemented massImportAppointments`)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright (c) 2018 The Python Packaging Authority
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
+
SOFTWARE.
|
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: minerva-zermelo
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python client for the Zermelo API
|
|
5
|
+
Project-URL: Homepage, https://github.com/DaniNotFound702/Minerva
|
|
6
|
+
Project-URL: Repository, https://github.com/DaniNotFound702/Minerva
|
|
7
|
+
Project-URL: Issues, https://github.com/DaniNotFound702/Minerva/issues
|
|
8
|
+
License: Copyright (c) 2018 The Python Packaging Authority
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Requires-Python: >=3.10
|
|
29
|
+
Requires-Dist: requests<3,>=2.31
|
|
30
|
+
Provides-Extra: dev
|
|
31
|
+
Requires-Dist: build; extra == 'dev'
|
|
32
|
+
Requires-Dist: pytest; extra == 'dev'
|
|
33
|
+
Requires-Dist: twine; extra == 'dev'
|
|
34
|
+
Provides-Extra: django
|
|
35
|
+
Requires-Dist: django<7,>=6.1; extra == 'django'
|
|
36
|
+
Provides-Extra: token
|
|
37
|
+
Requires-Dist: selenium<5,>=4.25; extra == 'token'
|
|
38
|
+
Description-Content-Type: text/markdown
|
|
39
|
+
|
|
40
|
+
# Minerva
|
|
41
|
+
|
|
42
|
+
Minerva is an importable Python library for interacting with the Zermelo API.
|
|
43
|
+
It provides an authenticated API client, convenience methods for common
|
|
44
|
+
Zermelo resources, appointment import utilities, and an optional Django API
|
|
45
|
+
wrapper.
|
|
46
|
+
|
|
47
|
+
You need access to the correct Zermelo school environment and a valid API token
|
|
48
|
+
to make requests.
|
|
49
|
+
|
|
50
|
+
## Installation
|
|
51
|
+
|
|
52
|
+
Minerva requires Python 3.10 or newer. Install it from the repository with:
|
|
53
|
+
|
|
54
|
+
Create and activate a virtual environment:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
python -m venv .venv
|
|
58
|
+
source .venv/bin/activate
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
On Windows, activate it with:
|
|
62
|
+
|
|
63
|
+
```powershell
|
|
64
|
+
\.venv\Scripts\Activate.ps1
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
On Linux, activate it with:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
source .venv/bin/activate
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Install the library:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
python -m pip install --upgrade pip
|
|
77
|
+
python -m pip install -e .
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
For development, install the optional dependencies as needed:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
python -m pip install -e ".[dev]"
|
|
84
|
+
python -m pip install -e ".[django]"
|
|
85
|
+
python -m pip install -e ".[token]"
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
The editable install makes the `minerva` package available to applications
|
|
89
|
+
running in the environment.
|
|
90
|
+
|
|
91
|
+
## Configuration
|
|
92
|
+
|
|
93
|
+
The library client can be configured directly in your application. This is the
|
|
94
|
+
recommended approach when credentials come from a settings page, secrets
|
|
95
|
+
manager, or command-line arguments:
|
|
96
|
+
|
|
97
|
+
```python
|
|
98
|
+
from minerva import ZermeloAPIClient
|
|
99
|
+
|
|
100
|
+
client = ZermeloAPIClient(
|
|
101
|
+
school="your-school",
|
|
102
|
+
authorization="Bearer your-api-token",
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
branches = client.get_endpoint(
|
|
106
|
+
"branches",
|
|
107
|
+
"fields=name,code,somCode,somUuid",
|
|
108
|
+
)
|
|
109
|
+
print(branches)
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
The values can come from a settings page, a secrets manager, command-line
|
|
113
|
+
arguments, or any other configuration source. A `.env` file is not required.
|
|
114
|
+
|
|
115
|
+
### Optional environment configuration
|
|
116
|
+
|
|
117
|
+
If your application uses environment variables, the client accepts these
|
|
118
|
+
values as a fallback:
|
|
119
|
+
|
|
120
|
+
Create a `.env` file in the root of the repository by copying
|
|
121
|
+
`.example.env`, then load it in your application with `python-dotenv` or your
|
|
122
|
+
preferred configuration library:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
cp .example.env .env
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
```env
|
|
129
|
+
SCHOOL=your-school
|
|
130
|
+
SCHOOLYEAR=your-school-year-id
|
|
131
|
+
AUTHORIZATION=Bearer your-api-token
|
|
132
|
+
EMAIL=your-email-address
|
|
133
|
+
PASSWORD=your-password
|
|
134
|
+
USER=your-user-id
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
`SCHOOL` is the school name used in the Zermelo URL, for example
|
|
138
|
+
`https://your-school.zportal.nl`. `AUTHORIZATION` must contain the full header
|
|
139
|
+
value, including `Bearer `. `SCHOOLYEAR` and `USER` are used by some parts of
|
|
140
|
+
the optional import helpers. `EMAIL` and `PASSWORD` are only needed when using
|
|
141
|
+
the automatic token helper.
|
|
142
|
+
|
|
143
|
+
Do not commit or share `.env`. It contains credentials and API access data.
|
|
144
|
+
The repository already ignores this file through `.gitignore`.
|
|
145
|
+
|
|
146
|
+
## Library usage
|
|
147
|
+
|
|
148
|
+
`ZermeloAPIClient` exposes `get_endpoint(endpoint, parameters)` for direct
|
|
149
|
+
requests. The endpoint name is appended to the school API URL and parameters
|
|
150
|
+
are supplied as a query string:
|
|
151
|
+
|
|
152
|
+
```python
|
|
153
|
+
from minerva import ZermeloAPIClient
|
|
154
|
+
|
|
155
|
+
client = ZermeloAPIClient(
|
|
156
|
+
school="your-school",
|
|
157
|
+
authorization="Bearer your-api-token",
|
|
158
|
+
)
|
|
159
|
+
|
|
160
|
+
branches = client.get_endpoint(
|
|
161
|
+
"branches",
|
|
162
|
+
"fields=name,code,somCode,somUuid",
|
|
163
|
+
)
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
For common requests, use `ZermeloMain` convenience methods. It accepts an
|
|
167
|
+
already configured `ZermeloAPIClient`:
|
|
168
|
+
|
|
169
|
+
```python
|
|
170
|
+
from minerva import ZermeloAPIClient, ZermeloMain
|
|
171
|
+
|
|
172
|
+
client = ZermeloAPIClient(
|
|
173
|
+
school="your-school",
|
|
174
|
+
authorization="Bearer your-api-token",
|
|
175
|
+
)
|
|
176
|
+
zermelo = ZermeloMain(client)
|
|
177
|
+
|
|
178
|
+
branches = zermelo.branches()
|
|
179
|
+
holidays = zermelo.holidays()
|
|
180
|
+
students = zermelo.studentsindepartments(schoolYear=1234)
|
|
181
|
+
appointments = zermelo.appointments(
|
|
182
|
+
schoolYear_id=1234,
|
|
183
|
+
schoolYear=2026,
|
|
184
|
+
user_id=5678,
|
|
185
|
+
)
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
The convenience layer also provides `branchesofschools()`,
|
|
189
|
+
`departmentsofbranches()`, `choosableindepartments()`, `groupindepartments()`,
|
|
190
|
+
`locationofbranches()`, `schoolsinschoolyears()`, `timeslotnames()`, and
|
|
191
|
+
`subjectselectionsubjects()`.
|
|
192
|
+
|
|
193
|
+
Successful calls return the API `data` value, usually a list of dictionaries.
|
|
194
|
+
Unauthorized or other API errors raise `ZermeloAPIError`; network errors from
|
|
195
|
+
`requests` are re-raised. A forbidden request returns `None`.
|
|
196
|
+
|
|
197
|
+
The main public exports are available directly from `minerva`:
|
|
198
|
+
|
|
199
|
+
```python
|
|
200
|
+
from minerva import (
|
|
201
|
+
ZermeloAPIClient,
|
|
202
|
+
ZermeloAPIError,
|
|
203
|
+
ZermeloMain,
|
|
204
|
+
Appointment,
|
|
205
|
+
Student,
|
|
206
|
+
saveAll,
|
|
207
|
+
configure_api_wrapper,
|
|
208
|
+
)
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### Optional token helper
|
|
212
|
+
|
|
213
|
+
The library requires a valid Zermelo API token to make requests. You can
|
|
214
|
+
provide one directly to `ZermeloAPIClient` or through the `AUTHORIZATION`
|
|
215
|
+
environment variable.
|
|
216
|
+
|
|
217
|
+
The optional helper in `src/minerva/helper/get_api_token.py` can retrieve a
|
|
218
|
+
token through the Zermelo login flow. It requires the `token` extra, `EMAIL`,
|
|
219
|
+
`PASSWORD`, Google Chrome, and a compatible ChromeDriver. The helper currently
|
|
220
|
+
expects ChromeDriver at `/usr/bin/chromedriver` on Linux.
|
|
221
|
+
|
|
222
|
+
## Optional appointment imports
|
|
223
|
+
|
|
224
|
+
`src/minerva/ImportData/MassImportAppointments.py` contains utilities for
|
|
225
|
+
importing appointments for a range of student IDs. Before using them, make sure
|
|
226
|
+
that:
|
|
227
|
+
|
|
228
|
+
- `.env` contains a valid `SCHOOL` and `AUTHORIZATION` value;
|
|
229
|
+
- `database.db` exists and contains the required `STUDENTS` table;
|
|
230
|
+
- you run the command from the repository root.
|
|
231
|
+
|
|
232
|
+
The import functions use a configured `ZermeloAPIClient` and store imported
|
|
233
|
+
appointments in SQLite. They are additional utilities and are not required to
|
|
234
|
+
use the API client.
|
|
235
|
+
|
|
236
|
+
## Optional Django API wrapper
|
|
237
|
+
|
|
238
|
+
The package also includes a Django wrapper for exposing selected Zermelo data
|
|
239
|
+
through HTTP. It currently provides:
|
|
240
|
+
|
|
241
|
+
- `GET /api/students/`
|
|
242
|
+
- `GET /api/appointments/`
|
|
243
|
+
|
|
244
|
+
Start the development server from the repository root:
|
|
245
|
+
|
|
246
|
+
```bash
|
|
247
|
+
python src/minerva/manage.py runserver
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
The wrapper is available at `http://127.0.0.1:8000/`. The endpoint
|
|
251
|
+
implementation reads its data from the local SQLite databases and supports
|
|
252
|
+
field selection where implemented by the endpoint.
|
|
253
|
+
|
|
254
|
+
### API-key authentication
|
|
255
|
+
|
|
256
|
+
Every request whose path starts with `/api/` must include an `X-Api-Key`
|
|
257
|
+
header. The key must match the value configured by the host application with
|
|
258
|
+
`configure_api_wrapper()`:
|
|
259
|
+
|
|
260
|
+
```python
|
|
261
|
+
from minerva import configure_api_wrapper
|
|
262
|
+
|
|
263
|
+
configure_api_wrapper("your-wrapper-key")
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
For deployment, generate a strong key and store it securely:
|
|
267
|
+
|
|
268
|
+
```bash
|
|
269
|
+
openssl rand -hex 32
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
Send the generated value directly as the header value. Do not add a
|
|
273
|
+
`Bearer` or `Api-Key` prefix:
|
|
274
|
+
|
|
275
|
+
```bash
|
|
276
|
+
curl \
|
|
277
|
+
-H "X-Api-Key: your-wrapper-key" \
|
|
278
|
+
http://127.0.0.1:8000/api/students/
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
Requests with a missing or incorrect key receive HTTP `401`. If no wrapper
|
|
282
|
+
key is configured, API requests receive HTTP `500`. Non-API paths do not
|
|
283
|
+
require the key.
|
|
284
|
+
|
|
285
|
+
### Students fields
|
|
286
|
+
|
|
287
|
+
The students endpoint supports these fields:
|
|
288
|
+
|
|
289
|
+
| Field | Type |
|
|
290
|
+
| --- | --- |
|
|
291
|
+
| `id` | Integer |
|
|
292
|
+
| `student` | Integer |
|
|
293
|
+
| `departmentOfBranch` | Integer |
|
|
294
|
+
| `mentorGroup` | Integer |
|
|
295
|
+
| `mainGroup` | Integer |
|
|
296
|
+
| `groupInDepartments` | String |
|
|
297
|
+
| `fullName` | String |
|
|
298
|
+
| `schoolInSchoolYear` | Integer |
|
|
299
|
+
| `firstName` | String |
|
|
300
|
+
| `lastName` | String |
|
|
301
|
+
| `departmentOfBranchCode` | String |
|
|
302
|
+
| `mainGroupName` | String |
|
|
303
|
+
| `prefix` | String |
|
|
304
|
+
|
|
305
|
+
## Testing
|
|
306
|
+
|
|
307
|
+
Run the test suite from the repository root:
|
|
308
|
+
|
|
309
|
+
```bash
|
|
310
|
+
python -m pytest
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
The middleware tests verify accepted and rejected API keys, missing keys, and
|
|
314
|
+
that non-API paths remain accessible.
|
|
315
|
+
|
|
316
|
+
## Current functionality
|
|
317
|
+
|
|
318
|
+
Available API data includes:
|
|
319
|
+
|
|
320
|
+
- Appointments
|
|
321
|
+
- Choosable departments
|
|
322
|
+
- School branches
|
|
323
|
+
- Users
|
|
324
|
+
- Departments of branches
|
|
325
|
+
- Branches
|
|
326
|
+
- Holidays and school years
|
|
327
|
+
- Students and subjects
|
|
328
|
+
|
|
329
|
+
## Credits
|
|
330
|
+
|
|
331
|
+
Parts of this project are inspired by
|
|
332
|
+
[ZermeloUtils](https://github.com/electricsteve/ZermeloUtils) by electricsteve.
|
|
333
|
+
|
|
334
|
+
AI was used to help explain code, complete parts of `get_api_token.py`, and
|
|
335
|
+
write documentation.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling>=1.26"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "minerva-zermelo"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Python client for the Zermelo API"
|
|
9
|
+
readme = "readme.md"
|
|
10
|
+
license = { file = "LICENSE" }
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
dependencies = [
|
|
13
|
+
"requests>=2.31,<3",
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
[project.optional-dependencies]
|
|
17
|
+
django = ["Django>=6.1,<7"]
|
|
18
|
+
token = ["selenium>=4.25,<5"]
|
|
19
|
+
dev = ["pytest", "build", "twine"]
|
|
20
|
+
|
|
21
|
+
[project.urls]
|
|
22
|
+
Homepage = "https://github.com/DaniNotFound702/Minerva"
|
|
23
|
+
Repository = "https://github.com/DaniNotFound702/Minerva"
|
|
24
|
+
Issues = "https://github.com/DaniNotFound702/Minerva/issues"
|
|
25
|
+
|
|
26
|
+
[tool.hatch.build.targets.wheel]
|
|
27
|
+
packages = ["src/minerva"]
|