Async Python client to interact with Ecole Directe API.
Project description
A fully async and easy to use API client for the Ecole Directe API. This package is mainly used by Home Assistant, to offer the Ecole Directe integration. If you want to use this package in your own project, you can look at the Home Assistant Code for more examples.
Free software: GNU General Public License v3
Documentation: https://ecoledirecte-api.readthedocs.io.
Features
TODO
Installation
$ pip install ecoledirecte
Getting started
import asyncio
import json
import logging
from pathlib import Path
from ecoledirecte_api.client import EDClient
from ecoledirecte_api.exceptions import BaseEcoleDirecteException
logger = logging.getLogger(__name__)
async def save_question(qcm_json):
"""Save question to file."""
with Path("qcm.json").open(
"w",
encoding="utf-8",
) as fp:
json.dump(qcm_json, fp, indent=4, ensure_ascii=False)
logger.info("Saved question to file", qcm_json)
async def main():
logging.basicConfig(filename="myapp.log", level=logging.DEBUG)
logger.info("Started")
try:
qcm_json = {}
with Path("qcm.json").open(
"r",
encoding="utf-8",
) as fp:
qcm_json = json.load(fp)
async with EDClient(
"user", "password", qcm_json
) as client:
client.on_new_question(save_question)
l = await client.login()
logger.info(f"l= {l}")
logger.info(f"Logged in as {client.username}")
logger.info("Finished")
await client.close()
except BaseEcoleDirecteException as e:
logger.exception(e.message)
return
except Exception as e:
logger.exception(e)
return
if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
Development - DevContainer (recommended)
If you use Visual Studio Code with Docker or GitHub CodeSpaces, you can leverage the available devcontainer. This will install all required dependencies and tools and has the right Python version available. Easy!
Credits
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
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 ecoledirecte-0.2.6.tar.gz.
File metadata
- Download URL: ecoledirecte-0.2.6.tar.gz
- Upload date:
- Size: 21.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 |
546cd068da073ed8d5df522e3789b14821d4d2e2319dd4393f424cf80a494321
|
|
| MD5 |
c859846b6431963bd0ff00830f7b271e
|
|
| BLAKE2b-256 |
51a0b00640aebbb8c9bc4f0c9bb6f36edcb76a6c265b74f491c073ba03562eb7
|
Provenance
The following attestation bundles were made for ecoledirecte-0.2.6.tar.gz:
Publisher:
release.yml on hacf-fr/ecoledirecte_api
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ecoledirecte-0.2.6.tar.gz -
Subject digest:
546cd068da073ed8d5df522e3789b14821d4d2e2319dd4393f424cf80a494321 - Sigstore transparency entry: 1227608899
- Sigstore integration time:
-
Permalink:
hacf-fr/ecoledirecte_api@73f9cab36ae4aaa35db69abe24667534780af756 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/hacf-fr
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@73f9cab36ae4aaa35db69abe24667534780af756 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ecoledirecte-0.2.6-py3-none-any.whl.
File metadata
- Download URL: ecoledirecte-0.2.6-py3-none-any.whl
- Upload date:
- Size: 21.4 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 |
40aa503d79ae625a339df4439f72e06768491a2f381c266164b09b9835ba3ef5
|
|
| MD5 |
b3ef0eb4140cc594ba83ab0fbe729aaa
|
|
| BLAKE2b-256 |
a8e39a1afd61851e687f7d057de0e71aa5b40da3a1cbbe15ad03afa9ef90dcd5
|
Provenance
The following attestation bundles were made for ecoledirecte-0.2.6-py3-none-any.whl:
Publisher:
release.yml on hacf-fr/ecoledirecte_api
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ecoledirecte-0.2.6-py3-none-any.whl -
Subject digest:
40aa503d79ae625a339df4439f72e06768491a2f381c266164b09b9835ba3ef5 - Sigstore transparency entry: 1227608960
- Sigstore integration time:
-
Permalink:
hacf-fr/ecoledirecte_api@73f9cab36ae4aaa35db69abe24667534780af756 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/hacf-fr
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@73f9cab36ae4aaa35db69abe24667534780af756 -
Trigger Event:
push
-
Statement type: