From 2a2928b4a0908791e5002f0ab170c94125315fa6 Mon Sep 17 00:00:00 2001 From: ValueRaider Date: Wed, 1 Feb 2023 13:31:54 +0000 Subject: [PATCH] Fix 'tradingPeriods' parsing when empty - 0.2.10b2 --- yfinance/utils.py | 4 ++++ yfinance/version.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/yfinance/utils.py b/yfinance/utils.py index 6e74ca71e..f7a1b0f4c 100644 --- a/yfinance/utils.py +++ b/yfinance/utils.py @@ -711,6 +711,10 @@ def format_history_metadata(md): del md["currentTradingPeriod"][m]["gmtoffset"] del md["currentTradingPeriod"][m]["timezone"] + if "tradingPeriods" in md: + if md["tradingPeriods"] == {"pre":[], "post":[]}: + del md["tradingPeriods"] + if "tradingPeriods" in md: tps = md["tradingPeriods"] if isinstance(tps, list): diff --git a/yfinance/version.py b/yfinance/version.py index 5fdab7e48..fc8a27a06 100644 --- a/yfinance/version.py +++ b/yfinance/version.py @@ -1 +1 @@ -version = "0.2.10b1" +version = "0.2.10b2"