Convert timedelta to human readable for HttpCacheConfig.serialize
MODIFY
plextraktsync/config/HttpCacheConfig.py
plextraktsync/config/HttpCacheConfig.py
@@ -107,9 +107,13 @@ def urls_expire_after(self) -> ExpirationPatterns:
return policy
def serialize(self):
+ policy = self.urls_expire_after.copy()
+ for k in (k for k, v in policy.items() if isinstance(v, timedelta)):
+ policy[k] = str(policy[k])
+
return {
"http_cache": {
- "policy": self.urls_expire_after,
+ "policy": policy,
},
}

Convert timedelta to human readable for HttpCacheConfig.serialize