Compare commits

..

4 Commits

Author SHA1 Message Date
85e7887b65 API
Some checks failed
Ik ben Henk python api ftp deploy / Deploy Python api (push) Has been cancelled
2025-12-01 14:52:22 +01:00
a7fe9d8614 API
Some checks failed
Ik ben Henk python api ftp deploy / Deploy Python api (push) Has been cancelled
2025-12-01 13:27:54 +01:00
0bfc2fd9c5 Dockerify
Some checks failed
Ik ben Henk python api ftp deploy / Deploy Python api (push) Has been cancelled
2025-12-01 13:18:53 +01:00
51d4f30de3 first commit
Some checks failed
Ik ben Henk python api ftp deploy / Deploy Python api (push) Has been cancelled
2025-12-01 13:16:37 +01:00
4 changed files with 34 additions and 5 deletions

23
Dockerfile Normal file
View File

@@ -0,0 +1,23 @@
# Dockerfile
FROM python:3.11-slim
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
WORKDIR /app
# (optioneel: system deps toevoegen als later nodig voor DB/libs)
RUN apt-get update && apt-get install -y --no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
# Python deps
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# App code
COPY . .
EXPOSE 5000
# Simpel: zelfde als startup.bat, maar dan Linux
CMD ["python", "app.py"]

9
app.py
View File

@@ -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/<countrycode>")
@@ -43,12 +43,13 @@ 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
if __name__ == "__main__":
app.run() # run our Flask app
app.run(host="0.0.0.0", port=5000) # ipv alleen app.run()

View File

@@ -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)

View File

@@ -11,6 +11,6 @@ import requests
response = requests.get('https://api.auctionviewer.ikbenhenk.nl//v2/refreshauction/NL')
if(response.status_code ==200):
print('ran getauctions request successfull')
print('ran getauctions request successful')
else:
print('A error occurred while running the getauctions request')