meteocatpy 0.0.12 → 0.0.14
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.
- package/CHANGELOG.md +16 -0
- package/meteocatpy/variables.py +3 -14
- package/meteocatpy/version.py +1 -1
- package/package.json +1 -1
- package/pyproject.toml +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
## [0.0.14](https://github.com/figorr/meteocatpy/compare/v0.0.13...v0.0.14) (2024-12-12)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* 0.0.14 ([56f4057](https://github.com/figorr/meteocatpy/commit/56f40575bfa985df9210119162c3857c19df36ba))
|
|
7
|
+
* remove cache ([991b274](https://github.com/figorr/meteocatpy/commit/991b27493ad3db5e0d05d3824b3ec45592275af7))
|
|
8
|
+
|
|
9
|
+
## [0.0.13](https://github.com/figorr/meteocatpy/compare/v0.0.12...v0.0.13) (2024-12-11)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* 0.0.13 ([1bdf3e7](https://github.com/figorr/meteocatpy/commit/1bdf3e7632156c0f033b483ac0ab5f159ed65be4))
|
|
15
|
+
* fix cache dir ([6303383](https://github.com/figorr/meteocatpy/commit/6303383e7cbf2efad27d288adf89c6ea58dbc9c4))
|
|
16
|
+
|
|
1
17
|
## [0.0.12](https://github.com/figorr/meteocatpy/compare/v0.0.11...v0.0.12) (2024-12-11)
|
|
2
18
|
|
|
3
19
|
|
package/meteocatpy/variables.py
CHANGED
|
@@ -7,7 +7,7 @@ from .exceptions import BadRequestError, ForbiddenError, TooManyRequestsError, I
|
|
|
7
7
|
class MeteocatVariables:
|
|
8
8
|
"""Clase para interactuar con la lista de variables de la API de Meteocat."""
|
|
9
9
|
|
|
10
|
-
def __init__(self, api_key: str
|
|
10
|
+
def __init__(self, api_key: str):
|
|
11
11
|
"""
|
|
12
12
|
Inicializa la clase MeteocatVariables.
|
|
13
13
|
|
|
@@ -20,23 +20,13 @@ class MeteocatVariables:
|
|
|
20
20
|
"X-Api-Key": self.api_key,
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
self._cache_dir = cache_dir or os.path.join("custom_components", "meteocat", ".meteocat_cache")
|
|
25
|
-
self._cache = Cache(self._cache_dir)
|
|
26
|
-
|
|
27
|
-
async def get_variables(self, force_update=False):
|
|
23
|
+
async def get_variables(self):
|
|
28
24
|
"""
|
|
29
|
-
Obtiene la lista de variables desde la API de Meteocat.
|
|
30
|
-
|
|
31
|
-
Args:
|
|
32
|
-
force_update (bool): Si es True, fuerza la actualización desde la API.
|
|
25
|
+
Obtiene la lista de variables desde la API de Meteocat.
|
|
33
26
|
|
|
34
27
|
Returns:
|
|
35
28
|
list: Datos de las variables.
|
|
36
29
|
"""
|
|
37
|
-
# Verificar si las variables están en caché y no se solicita actualización forzada
|
|
38
|
-
if not force_update and "variables" in self._cache:
|
|
39
|
-
return self._cache["variables"]
|
|
40
30
|
|
|
41
31
|
# Hacer la solicitud a la API para obtener las variables
|
|
42
32
|
url = f"{BASE_URL}{VARIABLES_URL}"
|
|
@@ -45,7 +35,6 @@ class MeteocatVariables:
|
|
|
45
35
|
async with session.get(url, headers=self.headers) as response:
|
|
46
36
|
if response.status == 200:
|
|
47
37
|
variables = await response.json()
|
|
48
|
-
self._cache["variables"] = variables # Guardar en caché
|
|
49
38
|
return variables
|
|
50
39
|
|
|
51
40
|
# Gestionar errores según el código de estado
|
package/meteocatpy/version.py
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
# version.py
|
|
2
|
-
__version__ = "0.0.
|
|
2
|
+
__version__ = "0.0.14"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "meteocatpy",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.14",
|
|
4
4
|
"description": "[](https://opensource.org/licenses/Apache-2.0)\r [](https://pypi.org/project/meteocatpy)\r [](https://gitlab.com/figorr/meteocatpy/commits/master)",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"directories": {
|