Skip to content
This repository was archived by the owner on Jun 10, 2026. It is now read-only.

Commit f46f0ab

Browse files
committed
Initial commit: classcharts-api Python library
0 parents  commit f46f0ab

18 files changed

Lines changed: 1956 additions & 0 deletions

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
secrets.local.json
2+
__pycache__/
3+
*.py[cod]
4+
*.egg-info/
5+
.eggs/
6+
dist/
7+
build/
8+
.env
9+
.venv/
10+
*.env

LICENSE

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
ISC License
2+
3+
Copyright (c) 2022 James Cook
4+
5+
Permission to use, copy, modify, and/or distribute this software for any
6+
purpose with or without fee is hereby granted, provided that the above
7+
copyright notice and this permission notice appear in all copies.
8+
9+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
10+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
12+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
14+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15+
PERFORMANCE OF THIS SOFTWARE.

README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# classcharts-api
2+
3+
A Python port of [classcharts-api-js](https://github.com/classchartsapi/classcharts-api-js) by James Cook.
4+
5+
Provides an async Python client for the ClassCharts parent and student APIs.
6+
7+
## Installation
8+
9+
```bash
10+
pip install classcharts-api
11+
```
12+
13+
## Usage
14+
15+
```python
16+
import asyncio
17+
from classcharts_api import ParentClient
18+
19+
async def main():
20+
async with ParentClient("email@example.com", "password") as client:
21+
await client.login()
22+
pupils = client.pupils
23+
homeworks = await client.get_homeworks_for_each_pupil(
24+
display_date="due_date",
25+
from_date="2026-01-01",
26+
to_date="2026-07-01",
27+
)
28+
for pupil_id, resp in homeworks.items():
29+
print(f"Pupil {pupil_id}: {len(resp['data'])} homework items")
30+
31+
asyncio.run(main())
32+
```
33+
34+
## License
35+
36+
ISC License — see [LICENSE](LICENSE).
37+
38+
This project is a Python port of [classcharts-api-js](https://github.com/classchartsapi/classcharts-api-js), copyright (c) 2022 James Cook, used under the ISC License.

pyproject.toml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
[build-system]
2+
requires = ["setuptools>=68", "wheel"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "classcharts-api"
7+
version = "1.0.0"
8+
description = "Async Python wrapper for the ClassCharts API"
9+
license = { text = "ISC" }
10+
requires-python = ">=3.11"
11+
keywords = ["classcharts", "school", "api", "home-assistant"]
12+
classifiers = [
13+
"Programming Language :: Python :: 3",
14+
"License :: OSI Approved :: ISC License (ISCL)",
15+
"Framework :: AsyncIO",
16+
"Intended Audience :: Developers",
17+
]
18+
dependencies = [
19+
"aiohttp>=3.9.0",
20+
]
21+
22+
[project.optional-dependencies]
23+
dev = [
24+
"pytest>=8.0",
25+
"pytest-asyncio>=0.23",
26+
"aioresponses>=0.7",
27+
"pytest-cov>=5.0",
28+
]
29+
30+
[tool.setuptools.packages.find]
31+
where = ["src"]
32+
33+
[tool.pytest.ini_options]
34+
asyncio_mode = "auto"
35+
testpaths = ["tests"]
36+
37+
[tool.ruff]
38+
line-length = 100

src/classcharts_api/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
"""ClassCharts API Python wrapper."""
2+
3+
from .parent_client import ParentClient
4+
from .student_client import StudentClient
5+
from .exceptions import ClassChartsAuthError, ClassChartsApiError
6+
from . import models
7+
8+
__all__ = [
9+
"ParentClient",
10+
"StudentClient",
11+
"ClassChartsAuthError",
12+
"ClassChartsApiError",
13+
"models",
14+
]

0 commit comments

Comments
 (0)