ecoledirecte 0.2.3__py3-none-any.whl
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.
- ecoledirecte-0.2.3.dist-info/METADATA +126 -0
- ecoledirecte-0.2.3.dist-info/RECORD +8 -0
- ecoledirecte-0.2.3.dist-info/WHEEL +4 -0
- ecoledirecte-0.2.3.dist-info/licenses/LICENSE +677 -0
- ecoledirecte_api/__init__.py +4 -0
- ecoledirecte_api/client.py +726 -0
- ecoledirecte_api/const.py +8 -0
- ecoledirecte_api/exceptions.py +51 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ecoledirecte
|
|
3
|
+
Version: 0.2.3
|
|
4
|
+
Summary: Async Python client to interact with Ecole Directe API.
|
|
5
|
+
License: LGPL-3.0-or-later
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Author: Giga77
|
|
8
|
+
Maintainer: Giga77
|
|
9
|
+
Requires-Python: >=3.10,<4.0
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
11
|
+
Classifier: License :: Free for non-commercial use
|
|
12
|
+
Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)
|
|
13
|
+
Classifier: Natural Language :: French
|
|
14
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
15
|
+
Requires-Dist: aiohttp (>=3.9.5)
|
|
16
|
+
Requires-Dist: backoff (>=1.10.0,<3.0)
|
|
17
|
+
Project-URL: Bug Tracker, https://github.com/hacf-fr/ecoledirecte_api/issues
|
|
18
|
+
Project-URL: Changelog, https://github.com/hacf-fr/ecoledirecte_api/releases
|
|
19
|
+
Project-URL: Homepage, https://github.com/hacf-fr/ecoledirecte_api
|
|
20
|
+
Project-URL: Repository, https://github.com/hacf-fr/ecoledirecte_api
|
|
21
|
+
Description-Content-Type: text/x-rst
|
|
22
|
+
|
|
23
|
+
=================
|
|
24
|
+
Ecole Directe API
|
|
25
|
+
=================
|
|
26
|
+
|PyPI| |Python Version| |License|
|
|
27
|
+
|
|
28
|
+
.. |PyPI| image:: https://img.shields.io/pypi/v/ecoledirecte.svg
|
|
29
|
+
:target: https://pypi.org/project/ecoledirecte/
|
|
30
|
+
:alt: PyPI
|
|
31
|
+
.. |Python Version| image:: https://img.shields.io/pypi/pyversions/ecoledirecte
|
|
32
|
+
:target: https://pypi.org/project/ecoledirecte
|
|
33
|
+
:alt: Python Version
|
|
34
|
+
.. |License| image:: https://img.shields.io/pypi/l/ecoledirecte
|
|
35
|
+
:target: https://opensource.org/licenses/lgpl-3-0
|
|
36
|
+
:alt: License
|
|
37
|
+
|
|
38
|
+
A fully async and easy to use API client for the Ecole Directe API.
|
|
39
|
+
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.
|
|
40
|
+
|
|
41
|
+
* Free software: GNU General Public License v3
|
|
42
|
+
* Documentation: https://ecoledirecte-api.readthedocs.io.
|
|
43
|
+
|
|
44
|
+
Features
|
|
45
|
+
--------
|
|
46
|
+
|
|
47
|
+
* TODO
|
|
48
|
+
|
|
49
|
+
Installation
|
|
50
|
+
------------
|
|
51
|
+
|
|
52
|
+
.. code:: console
|
|
53
|
+
|
|
54
|
+
$ pip install ecoledirecte
|
|
55
|
+
|
|
56
|
+
Getting started
|
|
57
|
+
---------------
|
|
58
|
+
|
|
59
|
+
.. code:: python
|
|
60
|
+
|
|
61
|
+
import asyncio
|
|
62
|
+
import json
|
|
63
|
+
import logging
|
|
64
|
+
from pathlib import Path
|
|
65
|
+
from ecoledirecte_api.client import EDClient
|
|
66
|
+
from ecoledirecte_api.exceptions import BaseEcoleDirecteException
|
|
67
|
+
|
|
68
|
+
logger = logging.getLogger(__name__)
|
|
69
|
+
|
|
70
|
+
async def save_question(qcm_json):
|
|
71
|
+
"""Save question to file."""
|
|
72
|
+
with Path("qcm.json").open(
|
|
73
|
+
"w",
|
|
74
|
+
encoding="utf-8",
|
|
75
|
+
) as fp:
|
|
76
|
+
json.dump(qcm_json, fp, indent=4, ensure_ascii=False)
|
|
77
|
+
logger.info("Saved question to file", qcm_json)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
async def main():
|
|
81
|
+
logging.basicConfig(filename="myapp.log", level=logging.DEBUG)
|
|
82
|
+
logger.info("Started")
|
|
83
|
+
try:
|
|
84
|
+
qcm_json = {}
|
|
85
|
+
with Path("qcm.json").open(
|
|
86
|
+
"r",
|
|
87
|
+
encoding="utf-8",
|
|
88
|
+
) as fp:
|
|
89
|
+
qcm_json = json.load(fp)
|
|
90
|
+
|
|
91
|
+
async with EDClient(
|
|
92
|
+
"user", "password", qcm_json
|
|
93
|
+
) as client:
|
|
94
|
+
client.on_new_question(save_question)
|
|
95
|
+
l = await client.login()
|
|
96
|
+
logger.info(f"l= {l}")
|
|
97
|
+
logger.info(f"Logged in as {client.username}")
|
|
98
|
+
logger.info("Finished")
|
|
99
|
+
await client.close()
|
|
100
|
+
except BaseEcoleDirecteException as e:
|
|
101
|
+
logger.exception(e.message)
|
|
102
|
+
return
|
|
103
|
+
except Exception as e:
|
|
104
|
+
logger.exception(e)
|
|
105
|
+
return
|
|
106
|
+
|
|
107
|
+
if __name__ == "__main__":
|
|
108
|
+
loop = asyncio.get_event_loop()
|
|
109
|
+
loop.run_until_complete(main())
|
|
110
|
+
|
|
111
|
+
Development - DevContainer (recommended)
|
|
112
|
+
----------------------------------------
|
|
113
|
+
|
|
114
|
+
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!
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
Credits
|
|
118
|
+
-------
|
|
119
|
+
|
|
120
|
+
This package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.
|
|
121
|
+
|
|
122
|
+
.. _Cookiecutter: https://github.com/audreyr/cookiecutter
|
|
123
|
+
.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage
|
|
124
|
+
.. _`Home Assistant Code`: https://github.com/hacf-fr/hass-ecoledirecte
|
|
125
|
+
|
|
126
|
+
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
ecoledirecte_api/__init__.py,sha256=KznX0dD3DPMY8Iu5vAc-zmmaZUBC008RSNUYOrjP2Pw,96
|
|
2
|
+
ecoledirecte_api/client.py,sha256=ys7gVq3HBG1rudpe5Su8xtPHi7CCGh76XtRSrdt8kfQ,24643
|
|
3
|
+
ecoledirecte_api/const.py,sha256=X9PUCnCbHdlVnKoHQ1NxwS_WyUTXNz6867aPSzVH-EM,162
|
|
4
|
+
ecoledirecte_api/exceptions.py,sha256=o05879j1A5R8YuFY1wBVK69FZrI6hW9JRhed_nBJolg,1432
|
|
5
|
+
ecoledirecte-0.2.3.dist-info/METADATA,sha256=pQVYvxrjja5ZRe1SB3fiWq_xas3_EkcfaBf7U75hp0Q,4193
|
|
6
|
+
ecoledirecte-0.2.3.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
|
7
|
+
ecoledirecte-0.2.3.dist-info/licenses/LICENSE,sha256=32oqs9XKcstQhSPLdLReBIRVZeRVMS3C5dmzzm8DBs8,35254
|
|
8
|
+
ecoledirecte-0.2.3.dist-info/RECORD,,
|