From a7fe9d8614eb3a3442c141d94e727bbbcf3ab53e Mon Sep 17 00:00:00 2001 From: michael1986 Date: Mon, 1 Dec 2025 13:27:54 +0100 Subject: [PATCH] API --- app.py | 6 +++--- cache.py | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app.py b/app.py index c3b81ec..a8efd51 100644 --- a/app.py +++ b/app.py @@ -28,7 +28,7 @@ def getAllAuctions(countrycode): except Exception as e: log('something went wrong ') - print_exc(e) + print_exc() return 'internal server error', 500 @app.route("/v2/refreshauction/") @@ -43,8 +43,8 @@ def refreshAllAuctions(countrycode): except Exception as e: log('something went wrong with refreshing the auctions') - print_exc(e) - return 'internal server error' + e, 500 + print_exc() + return 'internal server error', 500 diff --git a/cache.py b/cache.py index 58e813e..def7f38 100644 --- a/cache.py +++ b/cache.py @@ -1,4 +1,5 @@ from datetime import datetime, timedelta +import os import os.path from pathlib import Path import time @@ -69,5 +70,9 @@ class FileCache(): log('adding filecacheobject ' + key) json_data = JsonEncoder().encode(obj) # json_data = json.dumps(obj, cls=JsonEncoder, indent=2) + + # Ensure the filecache directory exists + os.makedirs("./filecache", exist_ok=True) + with open("./filecache/" + key + ".json", 'w+') as f: f.write(json_data)