pyetnic 0.0.4__tar.gz
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.
Potentially problematic release.
This version of pyetnic might be problematic. Click here for more details.
- pyetnic-0.0.4/LICENSE +21 -0
- pyetnic-0.0.4/MANIFEST.in +3 -0
- pyetnic-0.0.4/PKG-INFO +160 -0
- pyetnic-0.0.4/README.md +122 -0
- pyetnic-0.0.4/pyetnic/__init__.py +46 -0
- pyetnic-0.0.4/pyetnic/__main__.py +5 -0
- pyetnic-0.0.4/pyetnic/cli.py +47 -0
- pyetnic-0.0.4/pyetnic/config.py +93 -0
- pyetnic-0.0.4/pyetnic/log_config.py +15 -0
- pyetnic-0.0.4/pyetnic/resources/EpromFormationDocument1Service_external_v1.wsdl +103 -0
- pyetnic-0.0.4/pyetnic/resources/EpromFormationDocument2Service_external_v1.wsdl +76 -0
- pyetnic-0.0.4/pyetnic/resources/EpromFormationDocument3Service_external_v1.wsdl +76 -0
- pyetnic-0.0.4/pyetnic/resources/EpromFormationOrganisationService_external_v6.wsdl +130 -0
- pyetnic-0.0.4/pyetnic/resources/EpromFormationsListeService_external_v2.wsdl +76 -0
- pyetnic-0.0.4/pyetnic/resources/xsd/Addressing_v2.xsd +11 -0
- pyetnic-0.0.4/pyetnic/resources/xsd/AnneeScolaire_v1.xsd +7 -0
- pyetnic-0.0.4/pyetnic/resources/xsd/Authorisation_v2.xsd +15 -0
- pyetnic-0.0.4/pyetnic/resources/xsd/Common_v1.xsd +24 -0
- pyetnic-0.0.4/pyetnic/resources/xsd/EpromFormationDocument1Messages_external_v1.xsd +35 -0
- pyetnic-0.0.4/pyetnic/resources/xsd/EpromFormationDocument2Messages_external_v1.xsd +28 -0
- pyetnic-0.0.4/pyetnic/resources/xsd/EpromFormationDocument3Messages_external_v1.xsd +28 -0
- pyetnic-0.0.4/pyetnic/resources/xsd/EpromFormationOrganisationMessages_external_v6.xsd +142 -0
- pyetnic-0.0.4/pyetnic/resources/xsd/EpromFormationsListeMessages_external_v2.xsd +54 -0
- pyetnic-0.0.4/pyetnic/resources/xsd/Etablissement_v1.xsd +55 -0
- pyetnic-0.0.4/pyetnic/resources/xsd/FormationDocument1_v1.xsd +81 -0
- pyetnic-0.0.4/pyetnic/resources/xsd/FormationDocument2_v1.xsd +140 -0
- pyetnic-0.0.4/pyetnic/resources/xsd/FormationDocument3_v1.xsd +90 -0
- pyetnic-0.0.4/pyetnic/resources/xsd/FormationOrganisation_v2.xsd +46 -0
- pyetnic-0.0.4/pyetnic/resources/xsd/FormationOrganisation_v6.xsd +51 -0
- pyetnic-0.0.4/pyetnic/resources/xsd/Formation_v2.xsd +20 -0
- pyetnic-0.0.4/pyetnic/resources/xsd/Organisation_v1.xsd +21 -0
- pyetnic-0.0.4/pyetnic/resources/xsd/ResponseStatus_v3.xsd +25 -0
- pyetnic-0.0.4/pyetnic/resources/xsd/requestId_v1.xsd +8 -0
- pyetnic-0.0.4/pyetnic/services/__init__.py +72 -0
- pyetnic-0.0.4/pyetnic/services/document1.py +131 -0
- pyetnic-0.0.4/pyetnic/services/document2.py +155 -0
- pyetnic-0.0.4/pyetnic/services/document3.py +120 -0
- pyetnic-0.0.4/pyetnic/services/formations_liste.py +113 -0
- pyetnic-0.0.4/pyetnic/services/models.py +325 -0
- pyetnic-0.0.4/pyetnic/services/organisation.py +176 -0
- pyetnic-0.0.4/pyetnic/soap_client.py +120 -0
- pyetnic-0.0.4/pyetnic.egg-info/PKG-INFO +160 -0
- pyetnic-0.0.4/pyetnic.egg-info/SOURCES.txt +52 -0
- pyetnic-0.0.4/pyetnic.egg-info/dependency_links.txt +1 -0
- pyetnic-0.0.4/pyetnic.egg-info/entry_points.txt +2 -0
- pyetnic-0.0.4/pyetnic.egg-info/requires.txt +4 -0
- pyetnic-0.0.4/pyetnic.egg-info/top_level.txt +1 -0
- pyetnic-0.0.4/setup.cfg +4 -0
- pyetnic-0.0.4/setup.py +50 -0
- pyetnic-0.0.4/tests/test_formation_document1.py +291 -0
- pyetnic-0.0.4/tests/test_formation_document2.py +311 -0
- pyetnic-0.0.4/tests/test_formation_document3.py +319 -0
- pyetnic-0.0.4/tests/test_formation_organisation.py +324 -0
- pyetnic-0.0.4/tests/test_formations_liste.py +127 -0
pyetnic-0.0.4/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Fabien Toune
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
pyetnic-0.0.4/PKG-INFO
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pyetnic
|
|
3
|
+
Version: 0.0.4
|
|
4
|
+
Summary: Access to ETNIC web services through Python
|
|
5
|
+
Home-page: https://github.com/Lapin-Blanc/pyetnic
|
|
6
|
+
Author: Fabien Toune
|
|
7
|
+
Author-email: fabien.toune@eica.be
|
|
8
|
+
License: MIT
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Operating System :: OS Independent
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
+
Requires-Python: >=3.8
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: zeep
|
|
24
|
+
Requires-Dist: python-dotenv
|
|
25
|
+
Requires-Dist: requests
|
|
26
|
+
Requires-Dist: openpyxl
|
|
27
|
+
Dynamic: author
|
|
28
|
+
Dynamic: author-email
|
|
29
|
+
Dynamic: classifier
|
|
30
|
+
Dynamic: description
|
|
31
|
+
Dynamic: description-content-type
|
|
32
|
+
Dynamic: home-page
|
|
33
|
+
Dynamic: license
|
|
34
|
+
Dynamic: license-file
|
|
35
|
+
Dynamic: requires-dist
|
|
36
|
+
Dynamic: requires-python
|
|
37
|
+
Dynamic: summary
|
|
38
|
+
|
|
39
|
+
# pyetnic
|
|
40
|
+
|
|
41
|
+
Bibliothèque Python d'accès aux services web SOAP d'[ETNIC](https://www.etnic.be/) pour l'enseignement de promotion sociale (Wallonie-Bruxelles).
|
|
42
|
+
|
|
43
|
+
## Fonctionnalités
|
|
44
|
+
|
|
45
|
+
- **Formations** : lister les formations organisables et les formations organisées
|
|
46
|
+
- **Organisation** : créer, lire, modifier et supprimer une organisation de formation
|
|
47
|
+
- **Document 1** : lire, modifier et approuver le document de population (inscriptions)
|
|
48
|
+
- **Document 2** : lire et modifier le document des périodes d'activités d'enseignement
|
|
49
|
+
- **Document 3** : lire et modifier le document des attributions d'enseignants
|
|
50
|
+
|
|
51
|
+
## Installation
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
pip install pyetnic
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Configuration
|
|
58
|
+
|
|
59
|
+
Générer un fichier `.env` de départ avec la commande CLI :
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
pyetnic init-config
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Puis remplir les valeurs dans le fichier `.env` généré :
|
|
66
|
+
|
|
67
|
+
```ini
|
|
68
|
+
# Environnement : dev (services-web.tq.etnic.be) ou prod (services-web.etnic.be)
|
|
69
|
+
ENV=dev
|
|
70
|
+
|
|
71
|
+
# Identifiants pour le développement
|
|
72
|
+
DEV_USERNAME=
|
|
73
|
+
DEV_PASSWORD=
|
|
74
|
+
|
|
75
|
+
# Identifiants pour la production
|
|
76
|
+
PROD_USERNAME=
|
|
77
|
+
PROD_PASSWORD=
|
|
78
|
+
|
|
79
|
+
# Paramètres par défaut
|
|
80
|
+
DEFAULT_ETABID=
|
|
81
|
+
DEFAULT_IMPLID=
|
|
82
|
+
DEFAULT_SCHOOLYEAR=2024-2025
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Les identifiants sont ceux fournis par ETNIC pour accéder aux services web de votre établissement.
|
|
86
|
+
|
|
87
|
+
## Utilisation
|
|
88
|
+
|
|
89
|
+
### Lister les formations
|
|
90
|
+
|
|
91
|
+
```python
|
|
92
|
+
import pyetnic
|
|
93
|
+
|
|
94
|
+
# Formations organisables (catalogue)
|
|
95
|
+
result = pyetnic.lister_formations_organisables(annee_scolaire="2024-2025")
|
|
96
|
+
for formation in result:
|
|
97
|
+
print(formation.numAdmFormation, formation.libelleFormation)
|
|
98
|
+
|
|
99
|
+
# Formations organisées (avec leurs organisations)
|
|
100
|
+
result = pyetnic.lister_formations(annee_scolaire="2024-2025")
|
|
101
|
+
for formation in result:
|
|
102
|
+
for org in formation.organisations:
|
|
103
|
+
print(org.id.numOrganisation, org.dateDebutOrganisation, org.dateFinOrganisation)
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Organisation
|
|
107
|
+
|
|
108
|
+
```python
|
|
109
|
+
import pyetnic
|
|
110
|
+
|
|
111
|
+
# Lire une organisation
|
|
112
|
+
org = pyetnic.lire_organisation(
|
|
113
|
+
annee_scolaire="2024-2025",
|
|
114
|
+
etab_id=3052,
|
|
115
|
+
num_adm_formation=12345,
|
|
116
|
+
num_organisation=1,
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
# Modifier une organisation
|
|
120
|
+
pyetnic.modifier_organisation(organisation=org)
|
|
121
|
+
|
|
122
|
+
# Créer une organisation
|
|
123
|
+
pyetnic.creer_organisation(organisation=org)
|
|
124
|
+
|
|
125
|
+
# Supprimer une organisation
|
|
126
|
+
pyetnic.supprimer_organisation(organisation=org)
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Documents administratifs
|
|
130
|
+
|
|
131
|
+
```python
|
|
132
|
+
import pyetnic
|
|
133
|
+
|
|
134
|
+
# Document 1 - Population
|
|
135
|
+
doc1 = pyetnic.lire_document_1(annee_scolaire="2024-2025", etab_id=3052,
|
|
136
|
+
num_adm_formation=12345, num_organisation=1)
|
|
137
|
+
pyetnic.modifier_document_1(document=doc1)
|
|
138
|
+
pyetnic.approuver_document_1(document=doc1)
|
|
139
|
+
|
|
140
|
+
# Document 2 - Périodes d'activités
|
|
141
|
+
doc2 = pyetnic.lire_document_2(annee_scolaire="2024-2025", etab_id=3052,
|
|
142
|
+
num_adm_formation=12345, num_organisation=1)
|
|
143
|
+
pyetnic.modifier_document_2(document=doc2)
|
|
144
|
+
|
|
145
|
+
# Document 3 - Attributions d'enseignants
|
|
146
|
+
doc3 = pyetnic.lire_document_3(annee_scolaire="2024-2025", etab_id=3052,
|
|
147
|
+
num_adm_formation=12345, num_organisation=1)
|
|
148
|
+
pyetnic.modifier_document_3(document=doc3)
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## Dépendances
|
|
152
|
+
|
|
153
|
+
- [zeep](https://docs.python-zeep.org/) — client SOAP
|
|
154
|
+
- [python-dotenv](https://pypi.org/project/python-dotenv/) — chargement de la configuration
|
|
155
|
+
- [requests](https://pypi.org/project/requests/)
|
|
156
|
+
- [openpyxl](https://pypi.org/project/openpyxl/)
|
|
157
|
+
|
|
158
|
+
## Licence
|
|
159
|
+
|
|
160
|
+
MIT — voir [LICENSE](LICENSE)
|
pyetnic-0.0.4/README.md
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# pyetnic
|
|
2
|
+
|
|
3
|
+
Bibliothèque Python d'accès aux services web SOAP d'[ETNIC](https://www.etnic.be/) pour l'enseignement de promotion sociale (Wallonie-Bruxelles).
|
|
4
|
+
|
|
5
|
+
## Fonctionnalités
|
|
6
|
+
|
|
7
|
+
- **Formations** : lister les formations organisables et les formations organisées
|
|
8
|
+
- **Organisation** : créer, lire, modifier et supprimer une organisation de formation
|
|
9
|
+
- **Document 1** : lire, modifier et approuver le document de population (inscriptions)
|
|
10
|
+
- **Document 2** : lire et modifier le document des périodes d'activités d'enseignement
|
|
11
|
+
- **Document 3** : lire et modifier le document des attributions d'enseignants
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pip install pyetnic
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Configuration
|
|
20
|
+
|
|
21
|
+
Générer un fichier `.env` de départ avec la commande CLI :
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pyetnic init-config
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Puis remplir les valeurs dans le fichier `.env` généré :
|
|
28
|
+
|
|
29
|
+
```ini
|
|
30
|
+
# Environnement : dev (services-web.tq.etnic.be) ou prod (services-web.etnic.be)
|
|
31
|
+
ENV=dev
|
|
32
|
+
|
|
33
|
+
# Identifiants pour le développement
|
|
34
|
+
DEV_USERNAME=
|
|
35
|
+
DEV_PASSWORD=
|
|
36
|
+
|
|
37
|
+
# Identifiants pour la production
|
|
38
|
+
PROD_USERNAME=
|
|
39
|
+
PROD_PASSWORD=
|
|
40
|
+
|
|
41
|
+
# Paramètres par défaut
|
|
42
|
+
DEFAULT_ETABID=
|
|
43
|
+
DEFAULT_IMPLID=
|
|
44
|
+
DEFAULT_SCHOOLYEAR=2024-2025
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Les identifiants sont ceux fournis par ETNIC pour accéder aux services web de votre établissement.
|
|
48
|
+
|
|
49
|
+
## Utilisation
|
|
50
|
+
|
|
51
|
+
### Lister les formations
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
import pyetnic
|
|
55
|
+
|
|
56
|
+
# Formations organisables (catalogue)
|
|
57
|
+
result = pyetnic.lister_formations_organisables(annee_scolaire="2024-2025")
|
|
58
|
+
for formation in result:
|
|
59
|
+
print(formation.numAdmFormation, formation.libelleFormation)
|
|
60
|
+
|
|
61
|
+
# Formations organisées (avec leurs organisations)
|
|
62
|
+
result = pyetnic.lister_formations(annee_scolaire="2024-2025")
|
|
63
|
+
for formation in result:
|
|
64
|
+
for org in formation.organisations:
|
|
65
|
+
print(org.id.numOrganisation, org.dateDebutOrganisation, org.dateFinOrganisation)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Organisation
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
import pyetnic
|
|
72
|
+
|
|
73
|
+
# Lire une organisation
|
|
74
|
+
org = pyetnic.lire_organisation(
|
|
75
|
+
annee_scolaire="2024-2025",
|
|
76
|
+
etab_id=3052,
|
|
77
|
+
num_adm_formation=12345,
|
|
78
|
+
num_organisation=1,
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
# Modifier une organisation
|
|
82
|
+
pyetnic.modifier_organisation(organisation=org)
|
|
83
|
+
|
|
84
|
+
# Créer une organisation
|
|
85
|
+
pyetnic.creer_organisation(organisation=org)
|
|
86
|
+
|
|
87
|
+
# Supprimer une organisation
|
|
88
|
+
pyetnic.supprimer_organisation(organisation=org)
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Documents administratifs
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
import pyetnic
|
|
95
|
+
|
|
96
|
+
# Document 1 - Population
|
|
97
|
+
doc1 = pyetnic.lire_document_1(annee_scolaire="2024-2025", etab_id=3052,
|
|
98
|
+
num_adm_formation=12345, num_organisation=1)
|
|
99
|
+
pyetnic.modifier_document_1(document=doc1)
|
|
100
|
+
pyetnic.approuver_document_1(document=doc1)
|
|
101
|
+
|
|
102
|
+
# Document 2 - Périodes d'activités
|
|
103
|
+
doc2 = pyetnic.lire_document_2(annee_scolaire="2024-2025", etab_id=3052,
|
|
104
|
+
num_adm_formation=12345, num_organisation=1)
|
|
105
|
+
pyetnic.modifier_document_2(document=doc2)
|
|
106
|
+
|
|
107
|
+
# Document 3 - Attributions d'enseignants
|
|
108
|
+
doc3 = pyetnic.lire_document_3(annee_scolaire="2024-2025", etab_id=3052,
|
|
109
|
+
num_adm_formation=12345, num_organisation=1)
|
|
110
|
+
pyetnic.modifier_document_3(document=doc3)
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Dépendances
|
|
114
|
+
|
|
115
|
+
- [zeep](https://docs.python-zeep.org/) — client SOAP
|
|
116
|
+
- [python-dotenv](https://pypi.org/project/python-dotenv/) — chargement de la configuration
|
|
117
|
+
- [requests](https://pypi.org/project/requests/)
|
|
118
|
+
- [openpyxl](https://pypi.org/project/openpyxl/)
|
|
119
|
+
|
|
120
|
+
## Licence
|
|
121
|
+
|
|
122
|
+
MIT — voir [LICENSE](LICENSE)
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Pyetnic - Bibliothèque d'accès aux services web ETNIC pour l'enseignement de promotion sociale.
|
|
3
|
+
|
|
4
|
+
Ce module permet d'interagir avec les services SOAP d'ETNIC pour gérer les formations,
|
|
5
|
+
les organisations, les documents administratifs, etc.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
__version__ = '0.0.4'
|
|
9
|
+
__author__ = 'Fabien Toune'
|
|
10
|
+
|
|
11
|
+
# Exposition des fonctions principales pour un accès direct
|
|
12
|
+
from .services import (
|
|
13
|
+
# Formations liste
|
|
14
|
+
lister_formations,
|
|
15
|
+
lister_formations_organisables,
|
|
16
|
+
|
|
17
|
+
# Modèles
|
|
18
|
+
OrganisationApercu,
|
|
19
|
+
|
|
20
|
+
# Organisation
|
|
21
|
+
lire_organisation,
|
|
22
|
+
creer_organisation,
|
|
23
|
+
modifier_organisation,
|
|
24
|
+
supprimer_organisation,
|
|
25
|
+
|
|
26
|
+
# Document 1
|
|
27
|
+
lire_document_1,
|
|
28
|
+
modifier_document_1,
|
|
29
|
+
approuver_document_1,
|
|
30
|
+
|
|
31
|
+
# Document 2
|
|
32
|
+
lire_document_2,
|
|
33
|
+
modifier_document_2,
|
|
34
|
+
|
|
35
|
+
# Document 3
|
|
36
|
+
lire_document_3,
|
|
37
|
+
modifier_document_3,
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
# Exposition de la configuration
|
|
41
|
+
from .config import Config
|
|
42
|
+
|
|
43
|
+
from .cli import main as cli_main
|
|
44
|
+
|
|
45
|
+
def run_cli():
|
|
46
|
+
cli_main()
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# pyetnic/cli.py
|
|
3
|
+
import argparse
|
|
4
|
+
import os
|
|
5
|
+
|
|
6
|
+
def init_config(output_file='.env'):
|
|
7
|
+
contenu_env = """# Environnement : dev (services-web.tq.etnic.be) ou prod (services-web.etnic.be)
|
|
8
|
+
ENV=dev
|
|
9
|
+
|
|
10
|
+
# Identifiants pour le développement
|
|
11
|
+
DEV_USERNAME=
|
|
12
|
+
DEV_PASSWORD=
|
|
13
|
+
|
|
14
|
+
# Identifiants pour la production
|
|
15
|
+
PROD_USERNAME=
|
|
16
|
+
PROD_PASSWORD=
|
|
17
|
+
|
|
18
|
+
# Paramètres par défaut
|
|
19
|
+
DEFAULT_ETABID=3052
|
|
20
|
+
DEFAULT_IMPLID=6050
|
|
21
|
+
DEFAULT_SCHOOLYEAR=2023-2024
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
if os.path.exists(output_file):
|
|
25
|
+
overwrite = input(f"{output_file} existe déjà. Voulez-vous l'écraser ? (y/n): ")
|
|
26
|
+
if overwrite.lower() != 'y':
|
|
27
|
+
print("Opération annulée.")
|
|
28
|
+
return
|
|
29
|
+
|
|
30
|
+
with open(output_file, "w") as f:
|
|
31
|
+
f.write(contenu_env)
|
|
32
|
+
|
|
33
|
+
print(f"Fichier de configuration créé : {output_file}")
|
|
34
|
+
print("N'oubliez pas de remplir les valeurs manquantes dans le fichier.")
|
|
35
|
+
|
|
36
|
+
def main():
|
|
37
|
+
parser = argparse.ArgumentParser(description="Outils CLI pour pyetnic.")
|
|
38
|
+
parser.add_argument('command', choices=['init-config'], help="La commande à exécuter.")
|
|
39
|
+
parser.add_argument('--output', default='.env', help="Nom du fichier de sortie pour la configuration.")
|
|
40
|
+
|
|
41
|
+
args = parser.parse_args()
|
|
42
|
+
|
|
43
|
+
if args.command == 'init-config':
|
|
44
|
+
init_config(args.output)
|
|
45
|
+
|
|
46
|
+
if __name__ == '__main__':
|
|
47
|
+
main()
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# pyetnic/config.py
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Configuration centralisée pour les services ETNIC.
|
|
5
|
+
|
|
6
|
+
Ce module gère le chargement et la validation des variables d'environnement
|
|
7
|
+
nécessaires pour l'authentification et les paramètres par défaut.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
import os
|
|
11
|
+
import logging
|
|
12
|
+
from dotenv import load_dotenv
|
|
13
|
+
from typing import NamedTuple
|
|
14
|
+
|
|
15
|
+
# Configuration du logging
|
|
16
|
+
logger = logging.getLogger(__name__)
|
|
17
|
+
|
|
18
|
+
# Chargement des variables d'environnement
|
|
19
|
+
load_dotenv()
|
|
20
|
+
|
|
21
|
+
class ServiceConfig(NamedTuple):
|
|
22
|
+
endpoint: str
|
|
23
|
+
wsdl_path: str
|
|
24
|
+
binding_name: str
|
|
25
|
+
|
|
26
|
+
class Config:
|
|
27
|
+
"""Classe centralisée pour la configuration de l'application."""
|
|
28
|
+
|
|
29
|
+
# Environnement (dev, prod, etc.)
|
|
30
|
+
ENV = os.getenv('ENV', 'dev')
|
|
31
|
+
|
|
32
|
+
# Identifiants d'authentification
|
|
33
|
+
USERNAME = os.getenv(f"{ENV.upper()}_USERNAME")
|
|
34
|
+
PASSWORD = os.getenv(f"{ENV.upper()}_PASSWORD")
|
|
35
|
+
|
|
36
|
+
# Paramètres par défaut
|
|
37
|
+
ANNEE_SCOLAIRE = os.getenv("DEFAULT_SCHOOLYEAR", "2023-2024")
|
|
38
|
+
ETAB_ID = os.getenv("DEFAULT_ETABID")
|
|
39
|
+
IMPL_ID = os.getenv("DEFAULT_IMPLID")
|
|
40
|
+
|
|
41
|
+
# Configuration unifiée des services
|
|
42
|
+
SERVICES = {
|
|
43
|
+
"LISTE_FORMATIONS": ServiceConfig(
|
|
44
|
+
endpoint=f"https://services-web.{'tq.' if ENV == 'dev' else ''}etnic.be:11443/eprom/formations/liste/v2",
|
|
45
|
+
wsdl_path="EpromFormationsListeService_external_v2.wsdl",
|
|
46
|
+
binding_name="{http://services-web.etnic.be/eprom/formations/liste/v2}EPROMFormationsListeExternalV2Binding"
|
|
47
|
+
),
|
|
48
|
+
"ORGANISATION": ServiceConfig(
|
|
49
|
+
endpoint=f"https://services-web.{'tq.' if ENV == 'dev' else ''}etnic.be:11443/eprom/formation/organisation/v6",
|
|
50
|
+
wsdl_path="EpromFormationOrganisationService_external_v6.wsdl",
|
|
51
|
+
binding_name="{http://services-web.etnic.be/eprom/formation/organisation/v6}EPROMFormationOrganisationExternalV6Binding"
|
|
52
|
+
),
|
|
53
|
+
"DOCUMENT1": ServiceConfig(
|
|
54
|
+
endpoint=f"https://services-web.{'tq.' if ENV == 'dev' else ''}etnic.be:11443/eprom/formation/document1/v1",
|
|
55
|
+
wsdl_path="EpromFormationDocument1Service_external_v1.wsdl",
|
|
56
|
+
binding_name="{http://services-web.etnic.be/eprom/formation/document1/v1}EPROMFormationDocument1ExternalV1Binding"
|
|
57
|
+
),
|
|
58
|
+
"DOCUMENT2": ServiceConfig(
|
|
59
|
+
endpoint=f"https://services-web.{'tq.' if ENV == 'dev' else ''}etnic.be:11443/eprom/formation/document2/v1",
|
|
60
|
+
wsdl_path="EpromFormationDocument2Service_external_v1.wsdl",
|
|
61
|
+
binding_name="{http://services-web.etnic.be/eprom/formation/document2/v1}EPROMFormationDocument2ExternalV1Binding"
|
|
62
|
+
),
|
|
63
|
+
"DOCUMENT3": ServiceConfig(
|
|
64
|
+
endpoint=f"https://services-web.{'tq.' if ENV == 'dev' else ''}etnic.be:11443/eprom/formation/document3/v1",
|
|
65
|
+
wsdl_path="EpromFormationDocument3Service_external_v1.wsdl",
|
|
66
|
+
binding_name="{http://services-web.etnic.be/eprom/formation/document3/v1}EPROMFormationDocument3ExternalV1Binding"
|
|
67
|
+
),
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@classmethod
|
|
71
|
+
def validate(cls):
|
|
72
|
+
"""Valide que toutes les variables d'environnement nécessaires sont définies."""
|
|
73
|
+
missing = []
|
|
74
|
+
|
|
75
|
+
if not cls.USERNAME:
|
|
76
|
+
missing.append(f"{cls.ENV.upper()}_USERNAME")
|
|
77
|
+
if not cls.PASSWORD:
|
|
78
|
+
missing.append(f"{cls.ENV.upper()}_PASSWORD")
|
|
79
|
+
|
|
80
|
+
if missing:
|
|
81
|
+
logger.warning(f"Variables d'environnement manquantes : {', '.join(missing)}")
|
|
82
|
+
return False
|
|
83
|
+
|
|
84
|
+
return True
|
|
85
|
+
|
|
86
|
+
@classmethod
|
|
87
|
+
def get_verify_ssl(cls):
|
|
88
|
+
"""Retourne si la vérification SSL doit être activée."""
|
|
89
|
+
return cls.ENV != "dev"
|
|
90
|
+
|
|
91
|
+
# Validation initiale de la configuration
|
|
92
|
+
if not Config.validate():
|
|
93
|
+
logger.warning("Configuration incomplète. Certaines fonctionnalités pourraient ne pas fonctionner correctement.")
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
|
|
3
|
+
logger = logging.getLogger(__name__)
|
|
4
|
+
|
|
5
|
+
def configure_logging():
|
|
6
|
+
logger.info("Configuration du logging en cours...")
|
|
7
|
+
# Configuration de base
|
|
8
|
+
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
|
9
|
+
|
|
10
|
+
# Configuration spécifique pour chaque module
|
|
11
|
+
logging.getLogger('pyetnic.services.formations_liste').setLevel(logging.WARNING)
|
|
12
|
+
logging.getLogger('pyetnic.services.organisation').setLevel(logging.WARNING)
|
|
13
|
+
logging.getLogger('pyetnic.services.document2').setLevel(logging.WARNING)
|
|
14
|
+
|
|
15
|
+
# Vous pouvez ajouter d'autres configurations spécifiques ici
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:req="http://etnic.be/types/technical/requestId/v1" xmlns:tns="http://services-web.etnic.be/eprom/formation/document1/v1" xmlns:eprom="http://services-web.etnic.be/eprom/formation/document1/messages/v1" name="EPROMFormationDocument1V1ExternalService" targetNamespace="http://services-web.etnic.be/eprom/formation/document1/v1">
|
|
2
|
+
<wsdl:types>
|
|
3
|
+
<xs:schema>
|
|
4
|
+
<xs:import namespace="http://services-web.etnic.be/eprom/formation/document1/messages/v1" schemaLocation="xsd/EpromFormationDocument1Messages_external_v1.xsd"></xs:import>
|
|
5
|
+
<xs:import namespace="http://etnic.be/types/technical/requestId/v1" schemaLocation="xsd/requestId_v1.xsd"></xs:import>
|
|
6
|
+
</xs:schema>
|
|
7
|
+
</wsdl:types>
|
|
8
|
+
<wsdl:message name="ModifierDocument1ReponseMessage">
|
|
9
|
+
<wsdl:part name="parameter" element="eprom:ModifierDocument1Reponse">
|
|
10
|
+
</wsdl:part>
|
|
11
|
+
</wsdl:message>
|
|
12
|
+
<wsdl:message name="ApprouverDocument1RequeteMessage">
|
|
13
|
+
<wsdl:part name="parameter" element="eprom:ApprouverDocument1">
|
|
14
|
+
</wsdl:part>
|
|
15
|
+
</wsdl:message>
|
|
16
|
+
<wsdl:message name="LireDocument1ReponseMessage">
|
|
17
|
+
<wsdl:part name="parameter" element="eprom:LireDocument1Reponse">
|
|
18
|
+
</wsdl:part>
|
|
19
|
+
</wsdl:message>
|
|
20
|
+
<wsdl:message name="ApprouverDocument1ReponseMessage">
|
|
21
|
+
<wsdl:part name="parameter" element="eprom:ApprouverDocument1Reponse">
|
|
22
|
+
</wsdl:part>
|
|
23
|
+
</wsdl:message>
|
|
24
|
+
<wsdl:message name="ModifierDocument1RequeteMessage">
|
|
25
|
+
<wsdl:part name="parameter" element="eprom:ModifierDocument1">
|
|
26
|
+
</wsdl:part>
|
|
27
|
+
</wsdl:message>
|
|
28
|
+
<wsdl:message name="RequestIdHeader">
|
|
29
|
+
<wsdl:part name="requestId" element="req:requestId">
|
|
30
|
+
</wsdl:part>
|
|
31
|
+
</wsdl:message>
|
|
32
|
+
<wsdl:message name="LireDocument1RequeteMessage">
|
|
33
|
+
<wsdl:part name="parameter" element="eprom:LireDocument1">
|
|
34
|
+
</wsdl:part>
|
|
35
|
+
</wsdl:message>
|
|
36
|
+
<wsdl:portType name="EPROMFormationDocument1ExternalV1PortType">
|
|
37
|
+
<wsdl:operation name="LireDocument1">
|
|
38
|
+
<wsdl:input message="tns:LireDocument1RequeteMessage">
|
|
39
|
+
</wsdl:input>
|
|
40
|
+
<wsdl:output message="tns:LireDocument1ReponseMessage">
|
|
41
|
+
</wsdl:output>
|
|
42
|
+
</wsdl:operation>
|
|
43
|
+
<wsdl:operation name="ModifierDocument1">
|
|
44
|
+
<wsdl:input message="tns:ModifierDocument1RequeteMessage">
|
|
45
|
+
</wsdl:input>
|
|
46
|
+
<wsdl:output message="tns:ModifierDocument1ReponseMessage">
|
|
47
|
+
</wsdl:output>
|
|
48
|
+
</wsdl:operation>
|
|
49
|
+
<wsdl:operation name="ApprouverDocument1">
|
|
50
|
+
<wsdl:input message="tns:ApprouverDocument1RequeteMessage">
|
|
51
|
+
</wsdl:input>
|
|
52
|
+
<wsdl:output message="tns:ApprouverDocument1ReponseMessage">
|
|
53
|
+
</wsdl:output>
|
|
54
|
+
</wsdl:operation>
|
|
55
|
+
</wsdl:portType>
|
|
56
|
+
<wsdl:binding name="EPROMFormationDocument1ExternalV1Binding" type="tns:EPROMFormationDocument1ExternalV1PortType">
|
|
57
|
+
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"></soap:binding>
|
|
58
|
+
<wsdl:operation name="LireDocument1">
|
|
59
|
+
<soap:operation soapAction="http://services-web.etnic.be/eprom/formation/document1/v1/LireDocument1"></soap:operation>
|
|
60
|
+
<wsdl:input>
|
|
61
|
+
<soap:header message="tns:RequestIdHeader" part="requestId" use="literal" wsdl:required="false">
|
|
62
|
+
</soap:header>
|
|
63
|
+
<soap:body use="literal"></soap:body>
|
|
64
|
+
</wsdl:input>
|
|
65
|
+
<wsdl:output>
|
|
66
|
+
<soap:header message="tns:RequestIdHeader" part="requestId" use="literal" wsdl:required="true">
|
|
67
|
+
</soap:header>
|
|
68
|
+
<soap:body use="literal"></soap:body>
|
|
69
|
+
</wsdl:output>
|
|
70
|
+
</wsdl:operation>
|
|
71
|
+
<wsdl:operation name="ModifierDocument1">
|
|
72
|
+
<soap:operation soapAction="http://services-web.etnic.be/eprom/formation/document1/v1/ModifierDocument1"></soap:operation>
|
|
73
|
+
<wsdl:input>
|
|
74
|
+
<soap:header message="tns:RequestIdHeader" part="requestId" use="literal" wsdl:required="false">
|
|
75
|
+
</soap:header>
|
|
76
|
+
<soap:body use="literal"></soap:body>
|
|
77
|
+
</wsdl:input>
|
|
78
|
+
<wsdl:output>
|
|
79
|
+
<soap:header message="tns:RequestIdHeader" part="requestId" use="literal" wsdl:required="true">
|
|
80
|
+
</soap:header>
|
|
81
|
+
<soap:body use="literal"></soap:body>
|
|
82
|
+
</wsdl:output>
|
|
83
|
+
</wsdl:operation>
|
|
84
|
+
<wsdl:operation name="ApprouverDocument1">
|
|
85
|
+
<soap:operation soapAction="http://services-web.etnic.be/eprom/formation/document1/v1/ApprouverDocument1"></soap:operation>
|
|
86
|
+
<wsdl:input>
|
|
87
|
+
<soap:header message="tns:RequestIdHeader" part="requestId" use="literal" wsdl:required="false">
|
|
88
|
+
</soap:header>
|
|
89
|
+
<soap:body use="literal"></soap:body>
|
|
90
|
+
</wsdl:input>
|
|
91
|
+
<wsdl:output>
|
|
92
|
+
<soap:header message="tns:RequestIdHeader" part="requestId" use="literal" wsdl:required="true">
|
|
93
|
+
</soap:header>
|
|
94
|
+
<soap:body use="literal"></soap:body>
|
|
95
|
+
</wsdl:output>
|
|
96
|
+
</wsdl:operation>
|
|
97
|
+
</wsdl:binding>
|
|
98
|
+
<wsdl:service name="service_eprom_formation_document1_external_v1">
|
|
99
|
+
<wsdl:port name="EPROMFormationDocument1ExternalV1Port" binding="tns:EPROMFormationDocument1ExternalV1Binding">
|
|
100
|
+
<soap:address location="https://services-web.tq.etnic.be/eprom/formation/document1/v1"></soap:address>
|
|
101
|
+
</wsdl:port>
|
|
102
|
+
</wsdl:service>
|
|
103
|
+
</wsdl:definitions>
|