downloader.entsoe.download_new_data

downloader.entsoe.download_new_data(
    api_key,
    country_code='FR',
    start=None,
    end=None,
    force=False,
)

Download new load and forecast data from ENTSO-E.

This function queries the ENTSO-E Transparency Platform for a given period. If no start date is provided, it automatically resumes from the last available data point.

Parameters

Name Type Description Default
api_key str The ENTSO-E API key. required
country_code str The country code to query (e.g., ‘FR’, ‘DE’). Defaults to “FR”. 'FR'
start str | None Start date in ‘YYYYMMDDHH00’ format. None
end str | None End date in ‘YYYYMMDDHH00’ format. None
force bool If True, bypass the 24h cooldown check. False

Raises

Name Type Description
ImportError If the Python package ‘entsoe-py’ is not installed.
ValueError If start or end cannot be parsed as a valid timestamp.
RuntimeError If data fetching fails after _MAX_RETRIES attempts.

Notes

Logging information can be selected by setting the log level for the spotforecast2_safe.downloader.entsoe logger. Common levels are DEBUG, INFO, WARNING, ERROR, and CRITICAL. The cell below shows the default (WARNING); change the level to INFO or DEBUG for more verbose output.

import logging
logging.getLogger("spotforecast2_safe.downloader.entsoe").setLevel(logging.WARNING)

Examples

from spotforecast2_safe.downloader.entsoe import download_new_data

# Basic download for Germany with explicit start/end dates
download_new_data(
    api_key="YOUR_API_KEY",
    country_code="DE",
    start="202301010000",
    end="202301020000",
    force=True,
)

# Incremental download (automatically resumes from last data point)
download_new_data(api_key="YOUR_API_KEY", country_code="FR")

# Forced download bypassing the 24-hour cooldown check
download_new_data(
    api_key="YOUR_API_KEY",
    country_code="DE",
    force=True,
)