diff --git a/calculator/miner.py b/calculator/miner.py index 048b7e9..4a4c1d3 100644 --- a/calculator/miner.py +++ b/calculator/miner.py @@ -33,8 +33,13 @@ def get_energy_prices(d: datetime.date=datetime.date.today(), no_cache:bool=Fals if not hours or no_cache: r = requests.get(url_energy.format(date_str)) - data = r.json()["data"]["dataLine"][1]["point"] + resp = r.json()["data"]["dataLine"] + if len(resp) == 0: + raise PriceNotFound() + + data = resp[1]["point"] + if len(data) == 24: try: for raw in data: