Install via pip
python-esios is available on PyPI and can be installed using pip: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 supportpandas- Data analysis and manipulationpyarrow- Fast columnar data processingpydantic- Data validation and settings managementtenacity- Retry logic for API callstyper- CLI frameworkrich- 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).Request a token
Visit the ESIOS API page and request a personal token. Registration is free.
Configure Your Token
There are three ways to provide your API token to python-esios:Option 1: CLI Configuration (Recommended)
Use the CLI to store your token securely in a configuration file:~/.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 theESIOS_API_KEY environment variable:
.bashrc, .zshrc, etc.).
Option 3: Pass Directly in Code
Provide the token when creating the client:Verify Installation
Verify that python-esios is installed correctly by checking the version:Troubleshooting
Authentication Error
If you receive an authentication error:Import Error
If you get an import error when trying to use the library:Next Steps
Quick Start
Learn how to make your first query with python-esios
