From b85d316491b331de8de5b0bee77d998a498c78e5 Mon Sep 17 00:00:00 2001 From: Nathan Woodburn Date: Sat, 17 Feb 2024 11:57:04 +1100 Subject: [PATCH] feat: Download a csv for the report --- README.md | 2 +- main.py | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6b1d321..c18439c 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ python3 main.py On Windows: ```bash -python main.py +python3 main.py ``` diff --git a/main.py b/main.py index a966e70..b19ebce 100644 --- a/main.py +++ b/main.py @@ -1237,8 +1237,14 @@ def report(): return redirect("/login") account = account_module.check_account(request.cookies.get("account")) + csv = '\n'.join(account_module.generateReport(account)) + # Create a download - return jsonify(account_module.generateReport(account)) + response = make_response(csv) + response.headers["Content-Disposition"] = "attachment; filename=report.csv" + response.headers["Content-Type"] = "text/csv" + return response + #endregion