Metadata-Version: 2.4
Name: ecoledirecte-py-client
Version: 0.1.0
Summary: A comprehensive Python client for the EcoleDirecte API with MFA support.
Project-URL: Homepage, https://github.com/ngombert/ecoledirecte-py-client
Project-URL: Repository, https://github.com/ngombert/ecoledirecte-py-client
Project-URL: Issues, https://github.com/ngombert/ecoledirecte-py-client/issues
Author-email: Nicolas GOMBERT <gombert.n@gmail.com>
License: GPL-3.0-or-later
License-File: LICENSE
Keywords: api-client,ecoledirecte,education,france,mfa,student
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Education
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Education
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Requires-Dist: httpx>=0.28.1
Requires-Dist: pydantic>=2.12.5
Description-Content-Type: text/markdown

# ecoledirecte-py-client

A Python client for the EcoleDirecte API, supporting both Student and Family accounts with Multi-Factor Authentication (MFA) handling.

## Features

- **Dual Account Support**: Seamlessly handles both Student and Family (Parent) accounts.
- **MFA Support**: Integrated handling of CNED/MFA challenges.
- **Interactive & Automated MFA**: 
  - Prompts for MFA codes interactively if needed.
  - Caches known MFA answers in `qcm.json` for automated future logins.
- **Secure**: Sensitive data is managed via environment variables.

## Installation

This project uses `uv` for dependency management.

```bash
uv add ecoledirecte-py-client
```

## Configuration

1. **Environment Variables**:
   Create a `.env` file (or `.env_student` / `.env_family` for specific testing) with your credentials:

   ```env
   ECOLEDIRECTE_USERNAME=your_username
   ECOLEDIRECTE_PASSWORD=your_password
   # Optional: set to 'true' to skip actual login requests during dev
   ECOLEDIRECTE_DEMO_MODE=false 
   ```

2. **MFA Configuration**:
   The `qcm.json` file stores the mapping of MFA questions to answers. It is automatically updated when you solve a new challenge.
   
   *Note: Do not commit `qcm.json` if it contains personal answers, though the answers are specific to your account challenges.*

## Usage

```python
from ecoledirecte_py_client import Client
import asyncio

async def main():
    client = Client()
    await client.login("username", "password")
    # ...
```

Check the `examples/` directory for full usage scripts.

```bash
uv run --env-file .env examples/demo.py
```

## Project Structure

- `src/ecoledirecte_py_client/`: Core library code.
- `examples/`: Demo scripts.
- `qcm.json`: Local database of MFA Q&A.

## License

[GPLv3](LICENSE)
