added version 2 of the api

This commit is contained in:
Computerboer
2023-06-16 13:14:38 +02:00
parent 78afe97442
commit fd5ec112f4

19
app.py
View File

@@ -16,8 +16,25 @@ application = app # our hosting requires application in passenger_wsgi
def gethome():
return "application is working!"
@app.route("/v2/auction/<countrycode>")
def get(countrycode):
try:
if countrycode not in ['NL', 'BE', 'DE']:
print(f'country not available: {countrycode} ')
return jsonify('NOT AVAILABLE COUNTRY')
@app.route("/auction/<countrycode>")
res = getAuctionlocations(countrycode)
#return json.dumps(res, sort_keys=True, default=str)
return JsonEncoder().encode(res)
except Exception as e:
print('something went wrong ')
print_exc(e)
return 'internal server error', 500
@app.route("/v1/auction/<countrycode>")
def get(countrycode):
try:
if countrycode not in ['NL', 'BE', 'DE']: