Error fetching Bundesnetzagentur gas prices (URL changed)
the site https://www.bundesnetzagentur.de/_tools/SVG/js2/_functions/json.html?view=json&id=870302&xMin={start_formatted}&xMax={end_formatted}&singleType=1 returns 404, it seems like the moved their URL.
Using the following URL I can fetch again the latest gas prices https://www.bundesnetzagentur.de/_tools/_beispiele/SVG/js2/_functions/json.html?view=json&id=870302&xMin={start_formatted}&xMax={end_formatted}&singleType=1
This is a one-liner, do you want me to create a PR?
Can confirm this on v1.0.0 self-hosted. The URL fix alone isn't sufficient though -- there's a second issue in the error handling.
In gaspricestore.py line 72-77, the except block logs a warning (line 76) but then immediately re-raises the exception (line 77):
except Exception as e:
log.warning(f"... ignoring error: {e}")
raise e
The raise e defeats the "ignoring error" intent. Since gaspricestore.get_data() is called from pricepredictor.prepare_dataframe() during training, the unhandled exception prevents model training entirely, causing a KeyError: 'price' on all subsequent /prices and /prices_short requests (500 Internal Server Error).
Replacing raise e with pass fixes it -- the model trains without gas price data and the service works (gas prices are an optional feature per the README).
As a workaround until this is fixed, I'm running v1.0.0 with a startup command override that patches both issues:
command:
- /bin/sh
- -c
- |
sed -i 's|/_tools/SVG/js2/|/_tools/_beispiele/SVG/js2/|' /code/predictor/model/gaspricestore.py
sed -i 's/ raise e/ pass/' /code/predictor/model/gaspricestore.py
exec python3 /usr/local/bin/uvicorn predictor.api.priceapi:app --host 0.0.0.0 --port 80
It seems the new URL .. /_beispiele/SVG/ doesn't work anymore.
2026-07-30 09:39:10,993 [INFO] predictor.model.gaspricestore: DE_LU: Fetching natural gas price data: https://www.bundesnetzagentur.de/_tools/_beispiele/SVG/js2/_functions/json.html?view=json&id=870302&xMin=27.03.2026&xMax=11.08.2026&singleType=1 2026-07-30 09:39:11,317 [WARNING] predictor.model.gaspricestore: DE_LU: failed to update gas prices. Probably no data available for given time range - ignoring error: Expecting value: line 5 column 1 (char 4)
It did yesterday. Testing it in a browser i get 404
Sorry, bit busy right now. If someone can create a PR with a working and tested fix I'm happy to quickly merge it. If not we just have to disable gas prices for now.
Disabled it for now since it doesn't seem to be trivial to fix. Will have to look into it some time. If someone knows a better source for natural gas or fuel prices with a simple public API and liberal usage terms, please let me know.
Found a new source. It's for the polish energy market and prices are in PLN, but it should suffice as a proxy: https://energy.instrat.pl/en/prices/gas-dam/
Integrated in v1.0.2.