Python API wrapper for Aula.
Project description
Aula: Python Aula API Client Library
Python library for interacting with the Aula platform using the new MitID authentication system.
This library provides an asynchronous client (AulaApiClient) to fetch data such as profiles, daily overviews, messages, and calendar events from Aula.
TODO
Core functionality
- Calendar fetching
- Post fetching
- Messages fetching
- Daily Overview fetching
- Profile fetching
Widgets
- 0001 - EasyIQ - Ugeplan
- 0004 - Meebook Ugeplan
- 0019 - Biblioteket
- 0029 - MinUddannelse Ugenoter
- 0030 - MinUddannelse Opgaver
- 0047 - Fravær - forældreindberetning
- 0062 - Huskelisten
- 0121 - INFOBA Modulordninger til forældre
Library Usage
Here's a basic example of how to use the library with MitID authentication:
import asyncio
from aula import FileTokenStorage
from aula.auth_flow import authenticate_and_create_client
async def main():
# Replace with your MitID username
# NOTE: This is your MitID username, NOT your Aula username!
mitid_username = "your_mitid_username"
# Create a token storage backend (persists tokens to a file)
token_storage = FileTokenStorage(".aula_tokens.json")
# Authenticate and create a ready-to-use client
# First time: Will prompt you to approve in MitID app
# Subsequent times: Uses cached tokens (fast!)
async with await authenticate_and_create_client(mitid_username, token_storage) as client:
print(f"Successfully logged in! API URL: {client.api_url}")
# Fetch profile information
profile = await client.get_profile()
print(f"User: {profile.display_name} (ID: {profile.profile_id})")
if profile.children:
print("Children:")
for child in profile.children:
print(f" - {child.name} (ID: {child.id})")
# Fetch daily overview for the first child
if child == profile.children[0]:
overview = await client.get_daily_overview(child.id)
if overview:
print(f" Overview for {child.name}:")
print(f" - Status: {overview.status}")
else:
print("No children found.")
if __name__ == "__main__":
asyncio.run(main())
First Login Experience
When you run the code for the first time:
- You'll see a message: "Please approve the login in your MitID app"
- Open your MitID app on your phone
- You may need to scan a QR code or enter an OTP code (shown in terminal)
- Approve the login request
- Tokens are saved and cached for future use
On subsequent runs, tokens are loaded from cache - no MitID app interaction needed!
Available Methods
Key methods of AulaApiClient include:
is_logged_in(): Check if the session is currently active.get_profile(): Fetch user and child profile information.get_daily_overview(child_id): Fetch the daily overview for a specific child.get_message_threads(): Fetch message threads.get_messages_for_thread(thread_id): Fetch messages within a specific thread.get_calendar_events(...): Fetch calendar events.get_posts(...): Fetch posts/announcements.- ... (and others, see
api_client.pyfor details)
Data Models
The library uses dataclasses to structure the returned data (e.g., Profile, Child, DailyOverview, MessageThread). Check the src/aula/models/ package for the specific fields available in each model.
Authentication Requirements
What You Need
-
MitID Username: Your MitID username (NOT your Aula username)
- Find it by logging into https://mitid.dk/
- Usually in format: "FirstnameLastname" or similar
-
MitID App: The MitID mobile app installed on your phone
- Available on iOS and Android
- Must be set up and working
How Authentication Works
- First Login: Complete OAuth + SAML + MitID flow (requires app approval)
- Token Caching: Access tokens are saved to a local file
- Subsequent Logins: Tokens are reused (no app interaction needed)
- Token Expiration: When tokens expire, re-authenticate with app
Token Security
- Tokens provide full access to your Aula account
- Store token files securely
- Add to
.gitignore:.aula_tokens.json
Installation
Requirements
- Python >= 3.10
- MitID username and MitID app
Install from PyPI
pip install aula
Install from Source
git clone https://github.com/nickknissen/aula.git
cd aula
pip install -e .
Dependencies
The library automatically installs:
httpx- Async HTTP clientbeautifulsoup4- HTML parsingqrcode- QR code generation for MitIDpycryptodome- Cryptography for MitID protocol- Other required dependencies
CLI Tool
A command-line interface is included for quick access to Aula data. It uses MitID authentication.
# General command structure (username can also be set via AULA_MITID_USERNAME env var)
aula --username <your_mitid_username> [COMMAND] [OPTIONS]
CLI Commands
1. Login: Verifies credentials by authenticating with MitID.
aula --username <your_mitid_username> login
2. Profile: Fetches and displays profile information.
aula --username <your_mitid_username> profile
3. Overview:
Fetches the daily overview. By default, it fetches for all children. Specify a single child with --child-id.
# Get overview for all children
aula --username <your_mitid_username> overview
# Get overview for a specific child
aula --username <your_mitid_username> overview --child-id 12345
4. Messages: Fetches recent message threads and their contents.
aula --username <your_mitid_username> messages --limit 5
5. Calendar: Fetches calendar events for the next 7 days (default).
aula --username <your_mitid_username> calendar --start-date 2025-01-01 --end-date 2025-01-07
6. Posts: Fetches posts and announcements.
aula --username <your_mitid_username> posts --limit 10
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aula-0.1.0.tar.gz.
File metadata
- Download URL: aula-0.1.0.tar.gz
- Upload date:
- Size: 80.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b40a48be7945554f6b2a53824a52850d2158c11fd6d019ce27d55c1ec1d7e05e
|
|
| MD5 |
222bf3a1ea725b7ffa919ace229d92b2
|
|
| BLAKE2b-256 |
a6b61238cf3e8e621e216864953bf5bbd5faccdcb01cfb30290c1548e88fe522
|
Provenance
The following attestation bundles were made for aula-0.1.0.tar.gz:
Publisher:
publish.yml on nickknissen/aula
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aula-0.1.0.tar.gz -
Subject digest:
b40a48be7945554f6b2a53824a52850d2158c11fd6d019ce27d55c1ec1d7e05e - Sigstore transparency entry: 980416589
- Sigstore integration time:
-
Permalink:
nickknissen/aula@29b51f99cb7205b8976368d0d23713350b0ef71f -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/nickknissen
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@29b51f99cb7205b8976368d0d23713350b0ef71f -
Trigger Event:
release
-
Statement type:
File details
Details for the file aula-0.1.0-py3-none-any.whl.
File metadata
- Download URL: aula-0.1.0-py3-none-any.whl
- Upload date:
- Size: 53.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d6e2300170cdc79e0ea5cbf02db3f1c9e1e26b98e011311c0ce62cd30c113bac
|
|
| MD5 |
f775832ab495b3e97fba7133e3b90f96
|
|
| BLAKE2b-256 |
2d16286df4c8fee422a3b8bb7e4b787118c4ce864fa3238351e5dcf3f9e40542
|
Provenance
The following attestation bundles were made for aula-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on nickknissen/aula
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aula-0.1.0-py3-none-any.whl -
Subject digest:
d6e2300170cdc79e0ea5cbf02db3f1c9e1e26b98e011311c0ce62cd30c113bac - Sigstore transparency entry: 980416731
- Sigstore integration time:
-
Permalink:
nickknissen/aula@29b51f99cb7205b8976368d0d23713350b0ef71f -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/nickknissen
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@29b51f99cb7205b8976368d0d23713350b0ef71f -
Trigger Event:
release
-
Statement type: