meteocatpy 0.0.7 → 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.
Files changed (40) hide show
  1. package/.github/workflows/release.yml +33 -33
  2. package/.gitlab-ci.yml +46 -46
  3. package/.pre-commit-config.yaml +37 -37
  4. package/.releaserc +23 -23
  5. package/.releaserc.toml +14 -14
  6. package/AUTHORS.md +12 -12
  7. package/CHANGELOG.md +153 -137
  8. package/README.md +61 -61
  9. package/filetree.py +48 -48
  10. package/filetree.txt +48 -48
  11. package/meteocatpy/README.md +61 -61
  12. package/meteocatpy/__init__.py +27 -27
  13. package/meteocatpy/const.py +10 -10
  14. package/meteocatpy/data.py +93 -140
  15. package/meteocatpy/exceptions.py +35 -35
  16. package/meteocatpy/forecast.py +137 -137
  17. package/meteocatpy/helpers.py +46 -46
  18. package/meteocatpy/stations.py +71 -71
  19. package/meteocatpy/symbols.py +89 -89
  20. package/meteocatpy/town.py +61 -61
  21. package/meteocatpy/townstations.py +99 -99
  22. package/meteocatpy/variables.py +80 -74
  23. package/meteocatpy/version.py +2 -2
  24. package/package.json +23 -23
  25. package/poetry.lock +3313 -3313
  26. package/pyproject.toml +72 -72
  27. package/releaserc.json +17 -17
  28. package/requirements.test.txt +3 -3
  29. package/setup.cfg +64 -64
  30. package/setup.py +10 -10
  31. package/tests/data_test.py +122 -122
  32. package/tests/import_test.py +18 -18
  33. package/tests/integration_test_complete.py +76 -76
  34. package/tests/integration_test_forecast.py +54 -54
  35. package/tests/integration_test_station_data.py +33 -33
  36. package/tests/integration_test_stations.py +31 -31
  37. package/tests/integration_test_symbols.py +68 -68
  38. package/tests/integration_test_town.py +32 -32
  39. package/tests/integration_test_town_stations.py +36 -36
  40. package/tests/integration_test_variables.py +32 -32
package/README.md CHANGED
@@ -1,62 +1,62 @@
1
- # Meteocat Python Package for Meteocat Home Assistant Integration
2
-
3
- [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
4
- [![Python version compatibility](https://img.shields.io/pypi/pyversions/meteocatpy)](https://pypi.org/project/meteocatpy)
5
- [![pipeline status](https://gitlab.com/figorr/meteocatpy/badges/master/pipeline.svg)](https://gitlab.com/figorr/meteocatpy/commits/master)
6
-
7
-
8
- `meteocatpy` is a Python package to interact with the Meteocat API. Allows you to obtain meteorological data and lists of municipalities from the Meteocat API.
9
-
10
- **NOTE:** Meteocat API requires to use an API_KEY, you should ask to (https://apidocs.meteocat.gencat.cat/documentacio/acces-ciutada-i-administracio/)
11
-
12
- # Installation
13
-
14
- You can install the package from PyPI using `pip`:
15
- ```bash
16
- pip install meteocatpy
17
- ```
18
-
19
- ```bash
20
- from meteocatpy.client import MeteocatClient
21
-
22
- # Replace 'tu_api_key' with your actual API key
23
- api_key = "tu_api_key"
24
- client = MeteocatClient(api_key)
25
-
26
- # Get a list of municipalities (asynchronous call)
27
- municipis = await client.get_municipis()
28
- print(municipis)
29
- ```
30
-
31
- # Credits
32
-
33
- This is a personal project.
34
-
35
- Authors:
36
- - Figorr
37
-
38
- # Contributing
39
-
40
- If you would like to contribute to this project, please open an issue or create a pull request. I'd be happy to review your contributions!
41
-
42
- 1. [Check for open features/bugs](https://gitlab.com/figorr/meteocatpy/issues)
43
- or [initiate a discussion on one](https://gitlab.com/figorr/meteocatpy/issues/new).
44
- 2. [Fork the repository](https://gitlab.com/figorr/meteocatpy/forks/new).
45
- 3. Install the dev environment: `make init`.
46
- 4. Enter the virtual environment: `pipenv shell`
47
- 5. Code your new feature or bug fix.
48
- 6. Write a test that covers your new functionality.
49
- 7. Update `README.md` with any new documentation.
50
- 8. Run tests and ensure 100% code coverage for your contribution: `make coverage`
51
- 9. Ensure you have no linting errors: `make lint`
52
- 10. Ensure you have typed your code correctly: `make typing`
53
- 11. Add yourself to `AUTHORS.md`.
54
- 12. Submit a pull request!
55
-
56
- # License
57
-
58
- [Apache-2.0](LICENSE). By providing a contribution, you agree the contribution is licensed under Apache-2.0.
59
-
60
- # API Reference
61
-
1
+ # Meteocat Python Package for Meteocat Home Assistant Integration
2
+
3
+ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
4
+ [![Python version compatibility](https://img.shields.io/pypi/pyversions/meteocatpy)](https://pypi.org/project/meteocatpy)
5
+ [![pipeline status](https://gitlab.com/figorr/meteocatpy/badges/master/pipeline.svg)](https://gitlab.com/figorr/meteocatpy/commits/master)
6
+
7
+
8
+ `meteocatpy` is a Python package to interact with the Meteocat API. Allows you to obtain meteorological data and lists of municipalities from the Meteocat API.
9
+
10
+ **NOTE:** Meteocat API requires to use an API_KEY, you should ask to (https://apidocs.meteocat.gencat.cat/documentacio/acces-ciutada-i-administracio/)
11
+
12
+ # Installation
13
+
14
+ You can install the package from PyPI using `pip`:
15
+ ```bash
16
+ pip install meteocatpy
17
+ ```
18
+
19
+ ```bash
20
+ from meteocatpy.client import MeteocatClient
21
+
22
+ # Replace 'tu_api_key' with your actual API key
23
+ api_key = "tu_api_key"
24
+ client = MeteocatClient(api_key)
25
+
26
+ # Get a list of municipalities (asynchronous call)
27
+ municipis = await client.get_municipis()
28
+ print(municipis)
29
+ ```
30
+
31
+ # Credits
32
+
33
+ This is a personal project.
34
+
35
+ Authors:
36
+ - Figorr
37
+
38
+ # Contributing
39
+
40
+ If you would like to contribute to this project, please open an issue or create a pull request. I'd be happy to review your contributions!
41
+
42
+ 1. [Check for open features/bugs](https://gitlab.com/figorr/meteocatpy/issues)
43
+ or [initiate a discussion on one](https://gitlab.com/figorr/meteocatpy/issues/new).
44
+ 2. [Fork the repository](https://gitlab.com/figorr/meteocatpy/forks/new).
45
+ 3. Install the dev environment: `make init`.
46
+ 4. Enter the virtual environment: `pipenv shell`
47
+ 5. Code your new feature or bug fix.
48
+ 6. Write a test that covers your new functionality.
49
+ 7. Update `README.md` with any new documentation.
50
+ 8. Run tests and ensure 100% code coverage for your contribution: `make coverage`
51
+ 9. Ensure you have no linting errors: `make lint`
52
+ 10. Ensure you have typed your code correctly: `make typing`
53
+ 11. Add yourself to `AUTHORS.md`.
54
+ 12. Submit a pull request!
55
+
56
+ # License
57
+
58
+ [Apache-2.0](LICENSE). By providing a contribution, you agree the contribution is licensed under Apache-2.0.
59
+
60
+ # API Reference
61
+
62
62
  [See the docs 📚](https://apidocs.meteocat.gencat.cat/section/informacio-general/).
package/filetree.py CHANGED
@@ -1,48 +1,48 @@
1
- import subprocess
2
- import os
3
-
4
- def generate_file_tree():
5
- # Ruta donde se generará el archivo
6
- output_file = 'filetree.txt'
7
-
8
- # Ejecutar el comando git ls-files para obtener los archivos no ignorados
9
- git_command = ['git', 'ls-files']
10
- try:
11
- # Captura de la salida del comando git
12
- git_files = subprocess.check_output(git_command).decode('utf-8').splitlines()
13
-
14
- # Crear una estructura de árbol
15
- tree = {}
16
-
17
- # Construir el árbol de directorios
18
- for file in git_files:
19
- parts = file.split('/') # Separar la ruta del archivo por '/'
20
- current = tree
21
- for part in parts[:-1]: # Recorremos todos los directorios
22
- current = current.setdefault(part, {})
23
- current[parts[-1]] = None # El archivo final se marca como 'None'
24
-
25
- # Función recursiva para imprimir el árbol con la indentación correcta
26
- def print_tree(directory, indent=""):
27
- for name, subdirectory in directory.items():
28
- if subdirectory is None:
29
- # Si es un archivo, lo imprimimos
30
- f.write(f"{indent}├── {name}\n")
31
- else:
32
- # Si es un directorio, lo imprimimos y recursivamente llamamos a print_tree
33
- f.write(f"{indent}└── {name}/\n")
34
- print_tree(subdirectory, indent + " ")
35
-
36
- # Crear el archivo y escribir la estructura del árbol con codificación UTF-8
37
- with open(output_file, 'w', encoding='utf-8') as f:
38
- print_tree(tree)
39
-
40
- print(f"Árbol de directorios generado en: {os.path.abspath(output_file)}")
41
-
42
- except subprocess.CalledProcessError as e:
43
- print(f"Error al ejecutar el comando: {e}")
44
- except Exception as e:
45
- print(f"Ocurrió un error inesperado: {e}")
46
-
47
- if __name__ == "__main__":
48
- generate_file_tree()
1
+ import subprocess
2
+ import os
3
+
4
+ def generate_file_tree():
5
+ # Ruta donde se generará el archivo
6
+ output_file = 'filetree.txt'
7
+
8
+ # Ejecutar el comando git ls-files para obtener los archivos no ignorados
9
+ git_command = ['git', 'ls-files']
10
+ try:
11
+ # Captura de la salida del comando git
12
+ git_files = subprocess.check_output(git_command).decode('utf-8').splitlines()
13
+
14
+ # Crear una estructura de árbol
15
+ tree = {}
16
+
17
+ # Construir el árbol de directorios
18
+ for file in git_files:
19
+ parts = file.split('/') # Separar la ruta del archivo por '/'
20
+ current = tree
21
+ for part in parts[:-1]: # Recorremos todos los directorios
22
+ current = current.setdefault(part, {})
23
+ current[parts[-1]] = None # El archivo final se marca como 'None'
24
+
25
+ # Función recursiva para imprimir el árbol con la indentación correcta
26
+ def print_tree(directory, indent=""):
27
+ for name, subdirectory in directory.items():
28
+ if subdirectory is None:
29
+ # Si es un archivo, lo imprimimos
30
+ f.write(f"{indent}├── {name}\n")
31
+ else:
32
+ # Si es un directorio, lo imprimimos y recursivamente llamamos a print_tree
33
+ f.write(f"{indent}└── {name}/\n")
34
+ print_tree(subdirectory, indent + " ")
35
+
36
+ # Crear el archivo y escribir la estructura del árbol con codificación UTF-8
37
+ with open(output_file, 'w', encoding='utf-8') as f:
38
+ print_tree(tree)
39
+
40
+ print(f"Árbol de directorios generado en: {os.path.abspath(output_file)}")
41
+
42
+ except subprocess.CalledProcessError as e:
43
+ print(f"Error al ejecutar el comando: {e}")
44
+ except Exception as e:
45
+ print(f"Ocurrió un error inesperado: {e}")
46
+
47
+ if __name__ == "__main__":
48
+ generate_file_tree()
package/filetree.txt CHANGED
@@ -1,48 +1,48 @@
1
- └── .github/
2
- └── workflows/
3
- ├── release.yml
4
- ├── .gitignore
5
- ├── .gitlab-ci.yml
6
- ├── .pre-commit-config.yaml
7
- ├── .releaserc
8
- ├── .releaserc.toml
9
- ├── AUTHORS.md
10
- ├── CHANGELOG.md
11
- ├── LICENSE
12
- ├── README.md
13
- ├── filetree.py
14
- ├── filetree.txt
15
- └── meteocatpy/
16
- ├── README.md
17
- ├── __init__.py
18
- ├── const.py
19
- ├── data.py
20
- ├── exceptions.py
21
- ├── forecast.py
22
- ├── helpers.py
23
- ├── py.typed
24
- ├── stations.py
25
- ├── symbols.py
26
- ├── town.py
27
- ├── townstations.py
28
- ├── variables.py
29
- ├── version.py
30
- ├── package-lock.json
31
- ├── package.json
32
- ├── poetry.lock
33
- ├── pyproject.toml
34
- ├── releaserc.json
35
- ├── requirements.test.txt
36
- ├── setup.cfg
37
- ├── setup.py
38
- └── tests/
39
- ├── data_test.py
40
- ├── import_test.py
41
- ├── integration_test_complete.py
42
- ├── integration_test_forecast.py
43
- ├── integration_test_station_data.py
44
- ├── integration_test_stations.py
45
- ├── integration_test_symbols.py
46
- ├── integration_test_town.py
47
- ├── integration_test_town_stations.py
48
- ├── integration_test_variables.py
1
+ └── .github/
2
+ └── workflows/
3
+ ├── release.yml
4
+ ├── .gitignore
5
+ ├── .gitlab-ci.yml
6
+ ├── .pre-commit-config.yaml
7
+ ├── .releaserc
8
+ ├── .releaserc.toml
9
+ ├── AUTHORS.md
10
+ ├── CHANGELOG.md
11
+ ├── LICENSE
12
+ ├── README.md
13
+ ├── filetree.py
14
+ ├── filetree.txt
15
+ └── meteocatpy/
16
+ ├── README.md
17
+ ├── __init__.py
18
+ ├── const.py
19
+ ├── data.py
20
+ ├── exceptions.py
21
+ ├── forecast.py
22
+ ├── helpers.py
23
+ ├── py.typed
24
+ ├── stations.py
25
+ ├── symbols.py
26
+ ├── town.py
27
+ ├── townstations.py
28
+ ├── variables.py
29
+ ├── version.py
30
+ ├── package-lock.json
31
+ ├── package.json
32
+ ├── poetry.lock
33
+ ├── pyproject.toml
34
+ ├── releaserc.json
35
+ ├── requirements.test.txt
36
+ ├── setup.cfg
37
+ ├── setup.py
38
+ └── tests/
39
+ ├── data_test.py
40
+ ├── import_test.py
41
+ ├── integration_test_complete.py
42
+ ├── integration_test_forecast.py
43
+ ├── integration_test_station_data.py
44
+ ├── integration_test_stations.py
45
+ ├── integration_test_symbols.py
46
+ ├── integration_test_town.py
47
+ ├── integration_test_town_stations.py
48
+ ├── integration_test_variables.py
@@ -1,62 +1,62 @@
1
- # Meteocat Python Package for Meteocat Home Assistant Integration
2
-
3
- [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
4
- [![Python version compatibility](https://img.shields.io/pypi/pyversions/meteocatpy)](https://pypi.org/project/meteocatpy)
5
- [![pipeline status](https://gitlab.com/figorr/meteocatpy/badges/master/pipeline.svg)](https://gitlab.com/figorr/meteocatpy/commits/master)
6
-
7
-
8
- `meteocatpy` is a Python package to interact with the Meteocat API. Allows you to obtain meteorological data and lists of municipalities from the Meteocat API.
9
-
10
- **NOTE:** Meteocat API requires to use an API_KEY, you should ask to (https://apidocs.meteocat.gencat.cat/documentacio/acces-ciutada-i-administracio/)
11
-
12
- # Installation
13
-
14
- You can install the package from PyPI using `pip`:
15
- ```bash
16
- pip install meteocatpy
17
- ```
18
-
19
- ```bash
20
- from meteocatpy.town import MeteocatTown
21
-
22
- # Replace 'tu_api_key' with your actual API key
23
- API_KEY = "tu_api_key"
24
- town_client = MeteocatTown(API_KEY)
25
-
26
- # Get a list of municipalities (asynchronous call)
27
- municipios_data = await town_client.get_municipis()
28
- print(municipis)
29
- ```
30
-
31
- # Credits
32
-
33
- This is a personal project.
34
-
35
- Authors:
36
- - Figorr
37
-
38
- # Contributing
39
-
40
- If you would like to contribute to this project, please open an issue or create a pull request. I'd be happy to review your contributions!
41
-
42
- 1. [Check for open features/bugs](https://gitlab.com/figorr/meteocatpy/issues)
43
- or [initiate a discussion on one](https://gitlab.com/figorr/meteocatpy/issues/new).
44
- 2. [Fork the repository](https://gitlab.com/figorr/meteocatpy/forks/new).
45
- 3. Install the dev environment: `make init`.
46
- 4. Enter the virtual environment: `pipenv shell`
47
- 5. Code your new feature or bug fix.
48
- 6. Write a test that covers your new functionality.
49
- 7. Update `README.md` with any new documentation.
50
- 8. Run tests and ensure 100% code coverage for your contribution: `make coverage`
51
- 9. Ensure you have no linting errors: `make lint`
52
- 10. Ensure you have typed your code correctly: `make typing`
53
- 11. Add yourself to `AUTHORS.md`.
54
- 12. Submit a pull request!
55
-
56
- # License
57
-
58
- [Apache-2.0](LICENSE). By providing a contribution, you agree the contribution is licensed under Apache-2.0.
59
-
60
- # API Reference
61
-
1
+ # Meteocat Python Package for Meteocat Home Assistant Integration
2
+
3
+ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
4
+ [![Python version compatibility](https://img.shields.io/pypi/pyversions/meteocatpy)](https://pypi.org/project/meteocatpy)
5
+ [![pipeline status](https://gitlab.com/figorr/meteocatpy/badges/master/pipeline.svg)](https://gitlab.com/figorr/meteocatpy/commits/master)
6
+
7
+
8
+ `meteocatpy` is a Python package to interact with the Meteocat API. Allows you to obtain meteorological data and lists of municipalities from the Meteocat API.
9
+
10
+ **NOTE:** Meteocat API requires to use an API_KEY, you should ask to (https://apidocs.meteocat.gencat.cat/documentacio/acces-ciutada-i-administracio/)
11
+
12
+ # Installation
13
+
14
+ You can install the package from PyPI using `pip`:
15
+ ```bash
16
+ pip install meteocatpy
17
+ ```
18
+
19
+ ```bash
20
+ from meteocatpy.town import MeteocatTown
21
+
22
+ # Replace 'tu_api_key' with your actual API key
23
+ API_KEY = "tu_api_key"
24
+ town_client = MeteocatTown(API_KEY)
25
+
26
+ # Get a list of municipalities (asynchronous call)
27
+ municipios_data = await town_client.get_municipis()
28
+ print(municipis)
29
+ ```
30
+
31
+ # Credits
32
+
33
+ This is a personal project.
34
+
35
+ Authors:
36
+ - Figorr
37
+
38
+ # Contributing
39
+
40
+ If you would like to contribute to this project, please open an issue or create a pull request. I'd be happy to review your contributions!
41
+
42
+ 1. [Check for open features/bugs](https://gitlab.com/figorr/meteocatpy/issues)
43
+ or [initiate a discussion on one](https://gitlab.com/figorr/meteocatpy/issues/new).
44
+ 2. [Fork the repository](https://gitlab.com/figorr/meteocatpy/forks/new).
45
+ 3. Install the dev environment: `make init`.
46
+ 4. Enter the virtual environment: `pipenv shell`
47
+ 5. Code your new feature or bug fix.
48
+ 6. Write a test that covers your new functionality.
49
+ 7. Update `README.md` with any new documentation.
50
+ 8. Run tests and ensure 100% code coverage for your contribution: `make coverage`
51
+ 9. Ensure you have no linting errors: `make lint`
52
+ 10. Ensure you have typed your code correctly: `make typing`
53
+ 11. Add yourself to `AUTHORS.md`.
54
+ 12. Submit a pull request!
55
+
56
+ # License
57
+
58
+ [Apache-2.0](LICENSE). By providing a contribution, you agree the contribution is licensed under Apache-2.0.
59
+
60
+ # API Reference
61
+
62
62
  [See the docs 📚](https://apidocs.meteocat.gencat.cat/section/informacio-general/).
@@ -1,27 +1,27 @@
1
- """METEOCAT API.
2
-
3
- Python Package to collect data from Meteocat API and interact with Meteocat Home Assistant Integration
4
- SPDX-License-Identifier: Apache-2.0
5
-
6
- For more details about this API, please refer to the documentation at
7
- https://gitlab.com/figorr/meteocatpy
8
- """
9
-
10
- # meteocatpy/__init__.py
11
- from .town import MeteocatTown
12
- from .forecast import MeteocatForecast
13
- from .symbols import MeteocatSymbols
14
- from .stations import MeteocatStations
15
- from .townstations import MeteocatTownStations
16
- from .data import MeteocatStationData
17
- from .variables import MeteocatVariables
18
-
19
- __all__ = [
20
- "MeteocatTown",
21
- "MeteocatForecast",
22
- "MeteocatSymbols",
23
- "MeteocatStations",
24
- "MeteocatTownStations",
25
- "MeteocatStationData",
26
- "MeteocatVariables"
27
- ]
1
+ """METEOCAT API.
2
+
3
+ Python Package to collect data from Meteocat API and interact with Meteocat Home Assistant Integration
4
+ SPDX-License-Identifier: Apache-2.0
5
+
6
+ For more details about this API, please refer to the documentation at
7
+ https://gitlab.com/figorr/meteocatpy
8
+ """
9
+
10
+ # meteocatpy/__init__.py
11
+ from .town import MeteocatTown
12
+ from .forecast import MeteocatForecast
13
+ from .symbols import MeteocatSymbols
14
+ from .stations import MeteocatStations
15
+ from .townstations import MeteocatTownStations
16
+ from .data import MeteocatStationData
17
+ from .variables import MeteocatVariables
18
+
19
+ __all__ = [
20
+ "MeteocatTown",
21
+ "MeteocatForecast",
22
+ "MeteocatSymbols",
23
+ "MeteocatStations",
24
+ "MeteocatTownStations",
25
+ "MeteocatStationData",
26
+ "MeteocatVariables"
27
+ ]
@@ -1,10 +1,10 @@
1
- """meteocatpy constants."""
2
- BASE_URL = "https://api.meteo.cat"
3
- MUNICIPIS_LIST_URL = "/referencia/v1/municipis"
4
- MUNICIPIS_HORA_URL = "/pronostic/v1/municipalHoraria/{codi}"
5
- MUNICIPIS_DIA_URL = "/pronostic/v1/municipal/{codi}"
6
- SYMBOLS_URL = "/referencia/v1/simbols"
7
- STATIONS_LIST_URL = "/xema/v1/estacions/metadades"
8
- STATIONS_MUNICIPI_URL = "/xema/v1/representatives/metadades/municipis/{codi_municipi}/variables/{codi_variable}"
9
- VARIABLES_URL = "/xema/v1/variables/mesurades/metadades"
10
- STATION_DATA_URL = "/xema/v1/estacions/mesurades/{codiEstacio}/{any}/{mes}/{dia}"
1
+ """meteocatpy constants."""
2
+ BASE_URL = "https://api.meteo.cat"
3
+ MUNICIPIS_LIST_URL = "/referencia/v1/municipis"
4
+ MUNICIPIS_HORA_URL = "/pronostic/v1/municipalHoraria/{codi}"
5
+ MUNICIPIS_DIA_URL = "/pronostic/v1/municipal/{codi}"
6
+ SYMBOLS_URL = "/referencia/v1/simbols"
7
+ STATIONS_LIST_URL = "/xema/v1/estacions/metadades"
8
+ STATIONS_MUNICIPI_URL = "/xema/v1/representatives/metadades/municipis/{codi_municipi}/variables/{codi_variable}"
9
+ VARIABLES_URL = "/xema/v1/variables/mesurades/metadades"
10
+ STATION_DATA_URL = "/xema/v1/estacions/mesurades/{codiEstacio}/{any}/{mes}/{dia}"