aboutsummaryrefslogtreecommitdiffstats
path: root/app/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/utils.py')
-rw-r--r--app/utils.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/utils.py b/app/utils.py
index 5401c5c..8dc4972 100644
--- a/app/utils.py
+++ b/app/utils.py
@@ -50,3 +50,11 @@ def item_to_dict(item: Item) -> ItemDict:
def dict_to_item(d: ItemDict) -> Item:
pub_date, rest = (lambda pub_date, **rest: (pub_date, rest))(**d) # type: ignore
return Item(pub_date=datetime.fromisoformat(pub_date), **rest) # type: ignore
+
+
+def dump_to_file(prefix: str, text: str):
+ now = datetime.now().isoformat()
+ dump_file_name = f"dump/{prefix}__{now}"
+ with open(dump_file_name, "w") as f:
+ f.write(text)
+ return dump_file_name