Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/adrianaarang/climapp/llms.txt

Use this file to discover all available pages before exploring further.

ClimApp reads its configuration from a .env file in the project root using python-dotenv. Two environment variables control the application’s behaviour: AEMET_API_KEY, which is required for all AEMET API calls, and SECRET_KEY, which secures Flask sessions. This page explains how to obtain your API key and configure both variables correctly.

Getting an AEMET API key

AEMET provides free API access to its public weather observation data through the OpenData portal. Follow these steps to get your key:
1

Go to opendata.aemet.es

Open https://opendata.aemet.es in your browser. This is Spain’s official open meteorological data portal.
2

Register an account

Click Acceso con clave de API and then choose the option to register a new account. Fill in the required fields (name and email address) and submit the form.
3

Request your API key

After registration, AEMET will send your API key to the email address you provided. Copy the key — you will add it to your .env file in the next step. API keys are free and have no expiration date, but they are rate-limited by AEMET’s usage policies.

Environment variables

AEMET_API_KEY
string
required
Your API key from opendata.aemet.es. This key is sent as an api_key header on every request to the AEMET conventional observation endpoint. If this variable is missing when the application starts, WeatherAPIService raises a ValueError and the app will not serve weather data.
SECRET_KEY
string
default:"clave_secreta"
The Flask session secret. Used by Flask to cryptographically sign session cookies. Defaults to clave_secreta if not set. You should set this to a long, random string in any environment where you handle real user sessions.

Example .env file

Create this file in the root of your ClimApp project directory:
AEMET_API_KEY=your_api_key_from_aemet_here
SECRET_KEY=change_this_to_a_long_random_string
Flask loads these values automatically at startup via load_dotenv() at the top of app.py, making them available through os.getenv.
Never commit your .env file to version control. It contains secrets that grant access to your AEMET account and secure your Flask sessions. Add .env to your .gitignore file before your first commit.
ClimApp queries AEMET’s conventional observation endpoint to retrieve all active station readings:
https://opendata.aemet.es/opendata/api/observacion/convencional/todas
This URL is the base_url defined in WeatherAPIService. AEMET returns a metadata response whose datos field contains a second URL with the actual observation records. ClimApp follows this two-step pattern automatically on every /api/clima request.

Build docs developers (and LLMs) love