Convert str values to datetime in HttpCacheConfig
from requests_cache import DO_NOT_CACHE
+from plextraktsync.util.parse_date import parse_date
+
if TYPE_CHECKING:
from requests_cache import ExpirationPatterns
@@ -98,6 +100,10 @@ def urls_expire_after(self) -> ExpirationPatterns:
# This will keep the order if user overwrote the item
policy.update(self.policy)
+ # Parse string values with units to datetime
+ for k in (k for k, v in policy.items() if isinstance(v, str)):
+ policy[k] = parse_date(policy[k])
+
return policy
def serialize(self):
