api-24sea 0.2.2__tar.gz → 0.2.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.
- {api_24sea-0.2.2 → api_24sea-0.2.4}/PKG-INFO +74 -25
- {api_24sea-0.2.2 → api_24sea-0.2.4}/README.md +70 -21
- {api_24sea-0.2.2 → api_24sea-0.2.4}/api_24sea/version.py +1 -1
- {api_24sea-0.2.2 → api_24sea-0.2.4}/pyproject.toml +2 -2
- {api_24sea-0.2.2 → api_24sea-0.2.4}/LICENSE +0 -0
- {api_24sea-0.2.2 → api_24sea-0.2.4}/api_24sea/__init__.py +0 -0
- {api_24sea-0.2.2 → api_24sea-0.2.4}/api_24sea/datasignals/__init__.py +0 -0
- {api_24sea-0.2.2 → api_24sea-0.2.4}/api_24sea/datasignals/schemas.py +0 -0
- {api_24sea-0.2.2 → api_24sea-0.2.4}/api_24sea/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: api_24sea
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.4
|
|
4
4
|
Summary: The `api_24sea` package contains modules that are aimed at helping a user interact with the 24SEA API.
|
|
5
5
|
Author-email: Pietro D'Antuono <pietro.dantuono@24sea.eu>
|
|
6
6
|
Maintainer-email: Pietro D'Antuono <pietro.dantuono@24sea.eu>
|
|
@@ -10,7 +10,7 @@ Classifier: Development Status :: 4 - Beta
|
|
|
10
10
|
Classifier: Environment :: Console
|
|
11
11
|
Classifier: Intended Audience :: Science/Research
|
|
12
12
|
Classifier: Intended Audience :: Information Technology
|
|
13
|
-
Classifier: License :: OSI Approved :: GNU
|
|
13
|
+
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
|
14
14
|
Classifier: Natural Language :: English
|
|
15
15
|
Classifier: Operating System :: POSIX :: Linux
|
|
16
16
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -21,8 +21,8 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
21
21
|
Classifier: Programming Language :: Python :: 3.12
|
|
22
22
|
Classifier: Topic :: Database
|
|
23
23
|
Requires-Dist: pandas
|
|
24
|
-
Requires-Dist: requests
|
|
25
|
-
Requires-Dist: pydantic>=2
|
|
24
|
+
Requires-Dist: requests
|
|
25
|
+
Requires-Dist: pydantic>=2
|
|
26
26
|
Requires-Dist: sphinx ; extra == "docs"
|
|
27
27
|
Requires-Dist: sphinx_design ; extra == "docs"
|
|
28
28
|
Requires-Dist: autoclasstoc ; extra == "docs"
|
|
@@ -67,30 +67,15 @@ Provides-Extra: test
|
|
|
67
67
|
pip install api_24sea
|
|
68
68
|
```
|
|
69
69
|
|
|
70
|
-
##
|
|
70
|
+
## DataSignals Usage
|
|
71
71
|
|
|
72
|
-
```shell
|
|
73
|
-
.
|
|
74
|
-
├── .azure/
|
|
75
|
-
├── api_24sea/
|
|
76
|
-
│ ├── __init__.py
|
|
77
|
-
│ ├── datasignals/
|
|
78
|
-
│ │ ├── __init__.py
|
|
79
|
-
│ │ └── schemas.py
|
|
80
|
-
│ ├── utils.py
|
|
81
|
-
│ └── version.py
|
|
82
|
-
├── tests/
|
|
83
|
-
├── docs/
|
|
84
|
-
├── notebooks/
|
|
85
|
-
├── pyproject.toml
|
|
86
|
-
├── LICENSE
|
|
87
|
-
├── VERSION
|
|
88
|
-
└── README.md
|
|
89
|
-
```
|
|
90
72
|
|
|
91
|
-
|
|
73
|
+
The following example shows the classical usage of the datasignals module.
|
|
92
74
|
|
|
93
|
-
|
|
75
|
+
* The first step is to import the package and the necessary libraries.
|
|
76
|
+
* Then, the environment variables are loaded from a `.env` file.
|
|
77
|
+
* After that, the package is initialized and the user is authenticated with the API.
|
|
78
|
+
* Finally, the user can get data from the API.
|
|
94
79
|
|
|
95
80
|
### Importing the package
|
|
96
81
|
```python
|
|
@@ -110,6 +95,29 @@ import api_24sea
|
|
|
110
95
|
```
|
|
111
96
|
|
|
112
97
|
### Setting up the environment variables
|
|
98
|
+
|
|
99
|
+
This step assumes that you have a file structure similar to the following one:
|
|
100
|
+
|
|
101
|
+
```shell
|
|
102
|
+
.
|
|
103
|
+
├── env/
|
|
104
|
+
│ └── .env
|
|
105
|
+
├── notebooks/
|
|
106
|
+
│ └── example.ipynb
|
|
107
|
+
└── requirements.txt
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
The `.env` file should look like this:
|
|
111
|
+
|
|
112
|
+
```shell
|
|
113
|
+
API_USERNAME=your_username
|
|
114
|
+
API_PASSWORD=your_password
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
With this in mind, the following code snippet shows how to load the environment
|
|
119
|
+
variables from the `.env` file:
|
|
120
|
+
|
|
113
121
|
```python
|
|
114
122
|
# %%
|
|
115
123
|
_ = dotenv.load_dotenv("../env/.env")
|
|
@@ -121,6 +129,10 @@ else:
|
|
|
121
129
|
```
|
|
122
130
|
|
|
123
131
|
### Initializing an empty dataframe
|
|
132
|
+
|
|
133
|
+
Initializing an empty dataframe is necessary to use the API, as here is
|
|
134
|
+
where the data will be stored.
|
|
135
|
+
|
|
124
136
|
```python
|
|
125
137
|
# %%
|
|
126
138
|
df = pd.DataFrame()
|
|
@@ -134,20 +146,32 @@ except Exception as e:
|
|
|
134
146
|
```
|
|
135
147
|
|
|
136
148
|
### Authenticating with the API
|
|
149
|
+
|
|
150
|
+
The authentication step allows the user to access the API and check the
|
|
151
|
+
available metrics.
|
|
152
|
+
|
|
137
153
|
```python
|
|
138
154
|
# %%
|
|
139
155
|
df.datasignals.authenticate(
|
|
140
156
|
os.getenv("API_USERNAME"), os.getenv("API_PASSWORD")
|
|
141
157
|
)
|
|
158
|
+
# After authentication, the user can access the API
|
|
142
159
|
```
|
|
143
160
|
|
|
144
161
|
### Checking the available metrics after authentication
|
|
145
162
|
```python
|
|
146
163
|
# %%
|
|
147
164
|
df.datasignals.metrics_overview
|
|
165
|
+
# It will show all the available metrics with the corresponding units
|
|
166
|
+
# and the time window for which the user is allowed to get data
|
|
148
167
|
```
|
|
149
168
|
|
|
150
169
|
### Getting sample data from the API
|
|
170
|
+
|
|
171
|
+
After loading the environment variables and authenticating with the API,
|
|
172
|
+
the user can get data from [24SEA API endpoints](https://api.24sea.eu/redoc/v1/).
|
|
173
|
+
|
|
174
|
+
|
|
151
175
|
```python
|
|
152
176
|
# %%
|
|
153
177
|
sites = ["windfarm"]
|
|
@@ -175,3 +199,28 @@ df.datasignals.selected_metrics
|
|
|
175
199
|
df
|
|
176
200
|
```
|
|
177
201
|
|
|
202
|
+
## Project Structure
|
|
203
|
+
|
|
204
|
+
```shell
|
|
205
|
+
.
|
|
206
|
+
├── .azure/
|
|
207
|
+
├── api_24sea/
|
|
208
|
+
│ ├── __init__.py
|
|
209
|
+
│ ├── datasignals/
|
|
210
|
+
│ │ ├── __init__.py
|
|
211
|
+
│ │ └── schemas.py
|
|
212
|
+
│ ├── utils.py
|
|
213
|
+
│ └── version.py
|
|
214
|
+
├── tests/
|
|
215
|
+
├── docs/
|
|
216
|
+
├── notebooks/
|
|
217
|
+
├── pyproject.toml
|
|
218
|
+
├── LICENSE
|
|
219
|
+
├── VERSION
|
|
220
|
+
└── README.md
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
## License
|
|
224
|
+
|
|
225
|
+
The package is licensed under the [GNU General Public License v3.0](https://www.gnu.org/licenses/gpl-3.0.en.html).
|
|
226
|
+
|
|
@@ -8,30 +8,15 @@
|
|
|
8
8
|
pip install api_24sea
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## DataSignals Usage
|
|
12
12
|
|
|
13
|
-
```shell
|
|
14
|
-
.
|
|
15
|
-
├── .azure/
|
|
16
|
-
├── api_24sea/
|
|
17
|
-
│ ├── __init__.py
|
|
18
|
-
│ ├── datasignals/
|
|
19
|
-
│ │ ├── __init__.py
|
|
20
|
-
│ │ └── schemas.py
|
|
21
|
-
│ ├── utils.py
|
|
22
|
-
│ └── version.py
|
|
23
|
-
├── tests/
|
|
24
|
-
├── docs/
|
|
25
|
-
├── notebooks/
|
|
26
|
-
├── pyproject.toml
|
|
27
|
-
├── LICENSE
|
|
28
|
-
├── VERSION
|
|
29
|
-
└── README.md
|
|
30
|
-
```
|
|
31
13
|
|
|
32
|
-
|
|
14
|
+
The following example shows the classical usage of the datasignals module.
|
|
33
15
|
|
|
34
|
-
|
|
16
|
+
* The first step is to import the package and the necessary libraries.
|
|
17
|
+
* Then, the environment variables are loaded from a `.env` file.
|
|
18
|
+
* After that, the package is initialized and the user is authenticated with the API.
|
|
19
|
+
* Finally, the user can get data from the API.
|
|
35
20
|
|
|
36
21
|
### Importing the package
|
|
37
22
|
```python
|
|
@@ -51,6 +36,29 @@ import api_24sea
|
|
|
51
36
|
```
|
|
52
37
|
|
|
53
38
|
### Setting up the environment variables
|
|
39
|
+
|
|
40
|
+
This step assumes that you have a file structure similar to the following one:
|
|
41
|
+
|
|
42
|
+
```shell
|
|
43
|
+
.
|
|
44
|
+
├── env/
|
|
45
|
+
│ └── .env
|
|
46
|
+
├── notebooks/
|
|
47
|
+
│ └── example.ipynb
|
|
48
|
+
└── requirements.txt
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The `.env` file should look like this:
|
|
52
|
+
|
|
53
|
+
```shell
|
|
54
|
+
API_USERNAME=your_username
|
|
55
|
+
API_PASSWORD=your_password
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
With this in mind, the following code snippet shows how to load the environment
|
|
60
|
+
variables from the `.env` file:
|
|
61
|
+
|
|
54
62
|
```python
|
|
55
63
|
# %%
|
|
56
64
|
_ = dotenv.load_dotenv("../env/.env")
|
|
@@ -62,6 +70,10 @@ else:
|
|
|
62
70
|
```
|
|
63
71
|
|
|
64
72
|
### Initializing an empty dataframe
|
|
73
|
+
|
|
74
|
+
Initializing an empty dataframe is necessary to use the API, as here is
|
|
75
|
+
where the data will be stored.
|
|
76
|
+
|
|
65
77
|
```python
|
|
66
78
|
# %%
|
|
67
79
|
df = pd.DataFrame()
|
|
@@ -75,20 +87,32 @@ except Exception as e:
|
|
|
75
87
|
```
|
|
76
88
|
|
|
77
89
|
### Authenticating with the API
|
|
90
|
+
|
|
91
|
+
The authentication step allows the user to access the API and check the
|
|
92
|
+
available metrics.
|
|
93
|
+
|
|
78
94
|
```python
|
|
79
95
|
# %%
|
|
80
96
|
df.datasignals.authenticate(
|
|
81
97
|
os.getenv("API_USERNAME"), os.getenv("API_PASSWORD")
|
|
82
98
|
)
|
|
99
|
+
# After authentication, the user can access the API
|
|
83
100
|
```
|
|
84
101
|
|
|
85
102
|
### Checking the available metrics after authentication
|
|
86
103
|
```python
|
|
87
104
|
# %%
|
|
88
105
|
df.datasignals.metrics_overview
|
|
106
|
+
# It will show all the available metrics with the corresponding units
|
|
107
|
+
# and the time window for which the user is allowed to get data
|
|
89
108
|
```
|
|
90
109
|
|
|
91
110
|
### Getting sample data from the API
|
|
111
|
+
|
|
112
|
+
After loading the environment variables and authenticating with the API,
|
|
113
|
+
the user can get data from [24SEA API endpoints](https://api.24sea.eu/redoc/v1/).
|
|
114
|
+
|
|
115
|
+
|
|
92
116
|
```python
|
|
93
117
|
# %%
|
|
94
118
|
sites = ["windfarm"]
|
|
@@ -115,3 +139,28 @@ df.datasignals.selected_metrics
|
|
|
115
139
|
# %%
|
|
116
140
|
df
|
|
117
141
|
```
|
|
142
|
+
|
|
143
|
+
## Project Structure
|
|
144
|
+
|
|
145
|
+
```shell
|
|
146
|
+
.
|
|
147
|
+
├── .azure/
|
|
148
|
+
├── api_24sea/
|
|
149
|
+
│ ├── __init__.py
|
|
150
|
+
│ ├── datasignals/
|
|
151
|
+
│ │ ├── __init__.py
|
|
152
|
+
│ │ └── schemas.py
|
|
153
|
+
│ ├── utils.py
|
|
154
|
+
│ └── version.py
|
|
155
|
+
├── tests/
|
|
156
|
+
├── docs/
|
|
157
|
+
├── notebooks/
|
|
158
|
+
├── pyproject.toml
|
|
159
|
+
├── LICENSE
|
|
160
|
+
├── VERSION
|
|
161
|
+
└── README.md
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## License
|
|
165
|
+
|
|
166
|
+
The package is licensed under the [GNU General Public License v3.0](https://www.gnu.org/licenses/gpl-3.0.en.html).
|
|
@@ -13,7 +13,7 @@ classifiers=["Development Status :: 4 - Beta",
|
|
|
13
13
|
"Environment :: Console",
|
|
14
14
|
"Intended Audience :: Science/Research",
|
|
15
15
|
"Intended Audience :: Information Technology",
|
|
16
|
-
"License :: OSI Approved :: GNU
|
|
16
|
+
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
|
|
17
17
|
"Natural Language :: English",
|
|
18
18
|
"Operating System :: POSIX :: Linux",
|
|
19
19
|
"Programming Language :: Python :: 3",
|
|
@@ -27,7 +27,7 @@ authors = [{ name = "Pietro D'Antuono", email = "pietro.dantuono@24sea.eu" }]
|
|
|
27
27
|
maintainers = [{ name = "Pietro D'Antuono", email = "pietro.dantuono@24sea.eu" }]
|
|
28
28
|
# -- Project dependencies.
|
|
29
29
|
requires-python = ">=3.8.0"
|
|
30
|
-
dependencies = ["pandas", "requests
|
|
30
|
+
dependencies = ["pandas", "requests", "pydantic>=2"]
|
|
31
31
|
|
|
32
32
|
[project.urls]
|
|
33
33
|
"Documentation" = "https://api24seapydocs.blob.core.windows.net/$web/index.html"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|