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 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
 
@@ -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.
@@ -1,2 +1,2 @@
1
1
  # version.py
2
- __version__ = "0.0.8"
2
+ __version__ = "0.0.9"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "meteocatpy",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "description": "[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\r [![Python version compatibility](https://img.shields.io/pypi/pyversions/meteocatpy)](https://pypi.org/project/meteocatpy)\r [![pipeline status](https://gitlab.com/figorr/meteocatpy/badges/master/pipeline.svg)](https://gitlab.com/figorr/meteocatpy/commits/master)",
5
5
  "main": "index.js",
6
6
  "directories": {
package/pyproject.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "meteocatpy"
3
- version = "0.0.8"
3
+ version = "0.0.9"
4
4
  description = "Script para obtener datos meteorológicos de la API de Meteocat"
5
5
  authors = ["figorr <jdcuartero@yahoo.es>"]
6
6
  license = "Apache-2.0"