From 9d2950545ca7da193ddfb30d3c2d729f1f7ba28b Mon Sep 17 00:00:00 2001 From: Computerboer Date: Sat, 6 Apr 2024 16:15:55 +0200 Subject: [PATCH] fixed updated OVM api --- utils/auctionutils.py | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/utils/auctionutils.py b/utils/auctionutils.py index a3db012..bcbb459 100644 --- a/utils/auctionutils.py +++ b/utils/auctionutils.py @@ -18,10 +18,22 @@ def getAuctionlocations(countrycode: Countrycode): if(res): return res - twkauctions = getTwkAuctions(countrycode) - - ovmauctions = getOVMAuctions() + twkauctions = [] + ovmauctions = [] + + try: + twkauctions = getTwkAuctions(countrycode) + except Exception as e: + log('something went wrong while running the twk auctions request') + print_exc(e) + try: + ovmauctions = getOVMAuctions() + except Exception as e: + log('something went wrong while running the OVM auctions request') + print_exc(e) + + auctions = [*twkauctions, *ovmauctions] for auction in auctions: @@ -152,8 +164,8 @@ def getOVMAuctions(): cityname = "Nederland" if cityname is None else cityname #there can be auctions where you have to make an appointment to retrieve the lots startdatetime = result['openingsDatumISO'].replace("T", " ").replace("Z", "") enddatetime = result['sluitingsDatumISO'].replace("T", " ").replace("Z", "") - image = "" if result['image'] else image - a = Auction(Auctionbrand.OVM, cityname,result['land'], result['naam'],startdatetime, enddatetime, str(result['land']).lower() + '/veilingen/' + str(result['id']) + '/kavels', 'images/150x150/' + str(result['id']) + '/' + image, result['totaalKavels'] ) + image = "" if result['imageList'][0] else image + a = Auction(Auctionbrand.OVM, cityname,result['land'], result['naam'],startdatetime, enddatetime, str(result['land']).lower() + '/veilingen/' + str(result['id']) + '/kavels', 'images/150x150/' + image, result['totaalKavels'] ) auctions.append(a) Cache.add(cachename, auctions) return auctions