Skip to main content

Install via pip

python-esios is available on PyPI and can be installed using pip:
pip install python-esios
python-esios requires Python 3.10 or higher. Make sure your Python version meets this requirement before installing.

Dependencies

The library automatically installs the following dependencies:
  • httpx - Modern HTTP client with async support
  • pandas - Data analysis and manipulation
  • pyarrow - Fast columnar data processing
  • pydantic - Data validation and settings management
  • tenacity - Retry logic for API calls
  • typer - CLI framework
  • rich - Beautiful terminal output

Get Your API Token

To use python-esios, you need a free API token from Red Eléctrica de España (REE).
1

Request a token

Visit the ESIOS API page and request a personal token. Registration is free.
2

Receive your token

REE will send you your API token via email. Keep this token secure and don’t share it publicly.

Configure Your Token

There are three ways to provide your API token to python-esios: Use the CLI to store your token securely in a configuration file:
esios config set token YOUR_TOKEN
This stores the token in ~/.config/esios/config.toml. The token will be automatically used by both the CLI and Python library.
Replace YOUR_TOKEN with the actual token you received from REE.

Option 2: Environment Variable

Set the ESIOS_API_KEY environment variable:
export ESIOS_API_KEY="YOUR_TOKEN"
For permanent configuration, add the export command to your shell profile (.bashrc, .zshrc, etc.).

Option 3: Pass Directly in Code

Provide the token when creating the client:
from esios import ESIOSClient

client = ESIOSClient(token="YOUR_TOKEN")
Avoid hardcoding tokens in your source code, especially in version-controlled projects. Use environment variables or configuration files instead.

Verify Installation

Verify that python-esios is installed correctly by checking the version:
esios --version
Or test a simple query:
esios indicators search "precio"
If you see search results, your installation and token configuration are working correctly.

Troubleshooting

Authentication Error

If you receive an authentication error:
ESIOSError: API key required. Pass token= or set ESIOS_API_KEY env var.
Make sure you’ve configured your token using one of the three methods above.

Import Error

If you get an import error when trying to use the library:
ImportError: No module named 'esios'
Ensure you’ve installed the package and are using the correct Python environment:
pip install python-esios
python -c "import esios; print(esios.__version__)"

Next Steps

Quick Start

Learn how to make your first query with python-esios

Build docs developers (and LLMs) love