meteocatpy 0.0.8 → 0.0.9
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 +8 -0
- package/meteocatpy/variables.py +8 -2
- package/meteocatpy/version.py +1 -1
- package/package.json +1 -1
- package/pyproject.toml +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## [0.0.9](https://github.com/figorr/meteocatpy/compare/v0.0.8...v0.0.9) (2024-12-09)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* 0.0.9 ([0cf6bf8](https://github.com/figorr/meteocatpy/commit/0cf6bf888c572c3477a1385a06a753fc0096fc95))
|
|
7
|
+
* fix cache dir ([3cafd2f](https://github.com/figorr/meteocatpy/commit/3cafd2fb0ec2fcdf9d94cf3adb3fcb264aabeb9e))
|
|
8
|
+
|
|
1
9
|
## [0.0.8](https://github.com/figorr/meteocatpy/compare/v0.0.7...v0.0.8) (2024-12-08)
|
|
2
10
|
|
|
3
11
|
|
package/meteocatpy/variables.py
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import aiohttp
|
|
2
2
|
from diskcache import Cache
|
|
3
|
+
import os
|
|
3
4
|
from .const import BASE_URL, VARIABLES_URL
|
|
4
5
|
from .exceptions import BadRequestError, ForbiddenError, TooManyRequestsError, InternalServerError, UnknownAPIError
|
|
5
6
|
|
|
6
7
|
class MeteocatVariables:
|
|
7
8
|
"""Clase para interactuar con la lista de variables de la API de Meteocat."""
|
|
8
9
|
|
|
9
|
-
_cache = Cache(".meteocat_cache") # Directorio donde se guardará la caché
|
|
10
|
-
|
|
11
10
|
def __init__(self, api_key: str):
|
|
12
11
|
"""
|
|
13
12
|
Inicializa la clase MeteocatVariables.
|
|
@@ -21,6 +20,13 @@ class MeteocatVariables:
|
|
|
21
20
|
"X-Api-Key": self.api_key,
|
|
22
21
|
}
|
|
23
22
|
|
|
23
|
+
# Establecer la ruta absoluta a la carpeta de caché en custom_components/meteocat/.meteocat_cache
|
|
24
|
+
base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Subir dos niveles desde meteocatpy
|
|
25
|
+
self._cache_dir = os.path.join(base_dir, "custom_components", "meteocat", ".meteocat_cache")
|
|
26
|
+
|
|
27
|
+
# Crear la instancia de caché
|
|
28
|
+
self._cache = Cache(self._cache_dir)
|
|
29
|
+
|
|
24
30
|
async def get_variables(self, force_update=False):
|
|
25
31
|
"""
|
|
26
32
|
Obtiene la lista de variables desde la API de Meteocat. Usa la caché si está disponible.
|
package/meteocatpy/version.py
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
# version.py
|
|
2
|
-
__version__ = "0.0.
|
|
2
|
+
__version__ = "0.0.9"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "meteocatpy",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
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": {
|