API
Some checks failed
Ik ben Henk python api ftp deploy / Deploy Python api (push) Has been cancelled

This commit is contained in:
2025-12-01 13:27:54 +01:00
parent 0bfc2fd9c5
commit a7fe9d8614
2 changed files with 8 additions and 3 deletions

6
app.py
View File

@@ -28,7 +28,7 @@ def getAllAuctions(countrycode):
except Exception as e: except Exception as e:
log('something went wrong ') log('something went wrong ')
print_exc(e) print_exc()
return 'internal server error', 500 return 'internal server error', 500
@app.route("/v2/refreshauction/<countrycode>") @app.route("/v2/refreshauction/<countrycode>")
@@ -43,8 +43,8 @@ def refreshAllAuctions(countrycode):
except Exception as e: except Exception as e:
log('something went wrong with refreshing the auctions') log('something went wrong with refreshing the auctions')
print_exc(e) print_exc()
return 'internal server error' + e, 500 return 'internal server error', 500

View File

@@ -1,4 +1,5 @@
from datetime import datetime, timedelta from datetime import datetime, timedelta
import os
import os.path import os.path
from pathlib import Path from pathlib import Path
import time import time
@@ -69,5 +70,9 @@ class FileCache():
log('adding filecacheobject ' + key) log('adding filecacheobject ' + key)
json_data = JsonEncoder().encode(obj) json_data = JsonEncoder().encode(obj)
# json_data = json.dumps(obj, cls=JsonEncoder, indent=2) # 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: with open("./filecache/" + key + ".json", 'w+') as f:
f.write(json_data) f.write(json_data)