thorcast_api_client 0.1.2__tar.gz → 0.1.3__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.
- thorcast_api_client-0.1.3/PKG-INFO +78 -0
- thorcast_api_client-0.1.3/README.md +60 -0
- {thorcast_api_client-0.1.2 → thorcast_api_client-0.1.3}/pyproject.toml +2 -1
- {thorcast_api_client-0.1.2 → thorcast_api_client-0.1.3}/thorcast_api_client/auth.py +3 -7
- {thorcast_api_client-0.1.2 → thorcast_api_client-0.1.3}/thorcast_api_client/config.py +1 -1
- thorcast_api_client-0.1.2/PKG-INFO +0 -15
- {thorcast_api_client-0.1.2 → thorcast_api_client-0.1.3}/thorcast_api_client/__init__.py +0 -0
- {thorcast_api_client-0.1.2 → thorcast_api_client-0.1.3}/thorcast_api_client/client.py +0 -0
- {thorcast_api_client-0.1.2 → thorcast_api_client-0.1.3}/thorcast_api_client/exceptions.py +0 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: thorcast_api_client
|
|
3
|
+
Version: 0.1.3
|
|
4
|
+
Summary: Un client Python pour interagir avec l'API ThorCast
|
|
5
|
+
Author: JBCAYRE
|
|
6
|
+
Author-email: jcayre@mint.eco
|
|
7
|
+
Requires-Python: >=3.8,<4.0
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Requires-Dist: requests (>=2.26.0,<3.0.0)
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
|
|
18
|
+
# ThorCast API Client V0.1
|
|
19
|
+
|
|
20
|
+
## 📌 Description (je suis nul en Markdown , j'espère que ce sera lisible)
|
|
21
|
+
|
|
22
|
+
`thorcast_api_client` est un client Python permettant d'interagir avec l'API **ThorCast** mise en place par Holmium pour MINT.
|
|
23
|
+
|
|
24
|
+
Il prend en charge (normalement) :
|
|
25
|
+
- L'**authentification JWT**
|
|
26
|
+
- La récupération des **courbes de charge prévues**
|
|
27
|
+
- La récupération des **courbes de charge historiques**
|
|
28
|
+
- La gestion des **erreurs API**
|
|
29
|
+
|
|
30
|
+
## 🚀 Installation
|
|
31
|
+
|
|
32
|
+
### Via `pip`
|
|
33
|
+
```sh
|
|
34
|
+
pip install thorcast_api_client
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Via `poetry` pour les amateurs de Baudelaire
|
|
38
|
+
```sh
|
|
39
|
+
poetry add thorcast_api_client
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## 📜 Utilisation
|
|
43
|
+
|
|
44
|
+
### 🔒 Authentification :
|
|
45
|
+
|
|
46
|
+
L'authentification passe par la requête d'un token JWS en injectant un MDP/Username :
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
from thorcast_api_client.client import ThorCastClient
|
|
50
|
+
|
|
51
|
+
client = ThorCastClient("mon_user", "mon_mdp")
|
|
52
|
+
```
|
|
53
|
+
#### Lister les versions disponibles pour une ou plusieurs courbes LT
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
versions = client.get_lt_curves_versions(["prm1", "prm2"])
|
|
57
|
+
print(versions)
|
|
58
|
+
```
|
|
59
|
+
#### Récupérer les courbes de charge LT
|
|
60
|
+
|
|
61
|
+
```sh
|
|
62
|
+
courbes = client.get_lt_curves(["prm1", "prm2"], "2023-01-01T00:00:00Z", "2025-01-01T00:00:00Z")
|
|
63
|
+
print(courbes)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
#### Récupérer les versions des courbes de catalogue 🤷 (rien compris à ce que ça remonte)
|
|
67
|
+
|
|
68
|
+
```sh
|
|
69
|
+
version_catalogues = client.get_catalog_versions(["catalogue1", "catalogue2"], "2023-01-01T00:00:00Z", "2025-01-01T00:00:00Z")
|
|
70
|
+
print(version_catalogues)
|
|
71
|
+
```
|
|
72
|
+
#### Récupérer les courbes de charge historiques
|
|
73
|
+
|
|
74
|
+
```sh
|
|
75
|
+
courbes_catalogue = client.get_catalog_curves(["id_catalogue1", "id_catalogue2"])
|
|
76
|
+
print(courbes_catalogue)
|
|
77
|
+
```
|
|
78
|
+
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# ThorCast API Client V0.1
|
|
2
|
+
|
|
3
|
+
## 📌 Description (je suis nul en Markdown , j'espère que ce sera lisible)
|
|
4
|
+
|
|
5
|
+
`thorcast_api_client` est un client Python permettant d'interagir avec l'API **ThorCast** mise en place par Holmium pour MINT.
|
|
6
|
+
|
|
7
|
+
Il prend en charge (normalement) :
|
|
8
|
+
- L'**authentification JWT**
|
|
9
|
+
- La récupération des **courbes de charge prévues**
|
|
10
|
+
- La récupération des **courbes de charge historiques**
|
|
11
|
+
- La gestion des **erreurs API**
|
|
12
|
+
|
|
13
|
+
## 🚀 Installation
|
|
14
|
+
|
|
15
|
+
### Via `pip`
|
|
16
|
+
```sh
|
|
17
|
+
pip install thorcast_api_client
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### Via `poetry` pour les amateurs de Baudelaire
|
|
21
|
+
```sh
|
|
22
|
+
poetry add thorcast_api_client
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## 📜 Utilisation
|
|
26
|
+
|
|
27
|
+
### 🔒 Authentification :
|
|
28
|
+
|
|
29
|
+
L'authentification passe par la requête d'un token JWS en injectant un MDP/Username :
|
|
30
|
+
|
|
31
|
+
```sh
|
|
32
|
+
from thorcast_api_client.client import ThorCastClient
|
|
33
|
+
|
|
34
|
+
client = ThorCastClient("mon_user", "mon_mdp")
|
|
35
|
+
```
|
|
36
|
+
#### Lister les versions disponibles pour une ou plusieurs courbes LT
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
versions = client.get_lt_curves_versions(["prm1", "prm2"])
|
|
40
|
+
print(versions)
|
|
41
|
+
```
|
|
42
|
+
#### Récupérer les courbes de charge LT
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
courbes = client.get_lt_curves(["prm1", "prm2"], "2023-01-01T00:00:00Z", "2025-01-01T00:00:00Z")
|
|
46
|
+
print(courbes)
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
#### Récupérer les versions des courbes de catalogue 🤷 (rien compris à ce que ça remonte)
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
version_catalogues = client.get_catalog_versions(["catalogue1", "catalogue2"], "2023-01-01T00:00:00Z", "2025-01-01T00:00:00Z")
|
|
53
|
+
print(version_catalogues)
|
|
54
|
+
```
|
|
55
|
+
#### Récupérer les courbes de charge historiques
|
|
56
|
+
|
|
57
|
+
```sh
|
|
58
|
+
courbes_catalogue = client.get_catalog_curves(["id_catalogue1", "id_catalogue2"])
|
|
59
|
+
print(courbes_catalogue)
|
|
60
|
+
```
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "thorcast_api_client"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.3"
|
|
4
4
|
description = "Un client Python pour interagir avec l'API ThorCast"
|
|
5
5
|
authors = ["JBCAYRE <jcayre@mint.eco>"]
|
|
6
|
+
readme = "README.md"
|
|
6
7
|
|
|
7
8
|
[tool.poetry.dependencies]
|
|
8
9
|
python = "^3.8"
|
|
@@ -4,26 +4,22 @@ from thorcast_api_client.config import API_BASE_URL
|
|
|
4
4
|
class AuthManager:
|
|
5
5
|
"""Gère l'authentification et le rafraîchissement du token JWT."""
|
|
6
6
|
|
|
7
|
-
def __init__(self,
|
|
8
|
-
self.
|
|
7
|
+
def __init__(self, username: str, password: str):
|
|
8
|
+
self.username = username
|
|
9
9
|
self.password = password
|
|
10
10
|
self.token = None
|
|
11
11
|
self.refresh_token = None
|
|
12
|
-
self.is_active = None
|
|
13
|
-
self.user_id = None
|
|
14
12
|
|
|
15
13
|
def authenticate(self):
|
|
16
14
|
"""Récupère un token JWT"""
|
|
17
15
|
url = f"{API_BASE_URL}/backend/auth/token/"
|
|
18
|
-
payload = {"
|
|
16
|
+
payload = {"username": self.username, "password": self.password}
|
|
19
17
|
|
|
20
18
|
response = requests.post(url, json=payload)
|
|
21
19
|
if response.status_code == 200:
|
|
22
20
|
data = response.json()
|
|
23
21
|
self.token = data["access"]
|
|
24
22
|
self.refresh_token = data["refresh"]
|
|
25
|
-
self.is_active = data.get("is_active", None)
|
|
26
|
-
self.user_id = data.get("user_id", None)
|
|
27
23
|
else:
|
|
28
24
|
raise Exception(f"Erreur d'authentification: {response.text}")
|
|
29
25
|
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.3
|
|
2
|
-
Name: thorcast_api_client
|
|
3
|
-
Version: 0.1.2
|
|
4
|
-
Summary: Un client Python pour interagir avec l'API ThorCast
|
|
5
|
-
Author: JBCAYRE
|
|
6
|
-
Author-email: jcayre@mint.eco
|
|
7
|
-
Requires-Python: >=3.8,<4.0
|
|
8
|
-
Classifier: Programming Language :: Python :: 3
|
|
9
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
10
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
-
Requires-Dist: requests (>=2.26.0,<3.0.0)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|