From 84b190edab9899a266760f28136932cb83273066 Mon Sep 17 00:00:00 2001 From: Computerboer Date: Sun, 9 Jul 2023 21:19:08 +0200 Subject: [PATCH] bugfixes after onlineveilingmeester update --- cache.py | 4 ++-- utils/auctionutils.py | 12 +++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/cache.py b/cache.py index cd350e4..202c2fd 100644 --- a/cache.py +++ b/cache.py @@ -13,11 +13,11 @@ class Cache(): print('removing cacheobject ' + key) del cache[key] return None - #print('returning cacheobject ' + key) + print(str(datetime.now()) + ' returning cacheobject ' + key) return cacheobj.obj def add(key, obj): - print('adding cacheobject ' + key) + print(str(datetime.now()) + ' adding cacheobject ' + key) cacheobj = CacheObj(key, obj) cache[key] = cacheobj diff --git a/utils/auctionutils.py b/utils/auctionutils.py index 517264d..ca4a538 100644 --- a/utils/auctionutils.py +++ b/utils/auctionutils.py @@ -1,4 +1,3 @@ -from asyncio.windows_events import NULL import requests from cache import Cache from models.location import Auction, Auctionbrand, Countrycode, Maplocation @@ -9,9 +8,9 @@ def getAuctionlocations(countrycode: Countrycode): cachename = 'allauctions_' + countrycode res = Cache.get(cachename) - if(res): return res + if(res): + return res - twkauctions = getTwkAuctions(countrycode) ovmauctions = getOVMAuctions() auctions = [*twkauctions, *ovmauctions] @@ -52,7 +51,8 @@ def get_geonameid(auction): def getTwkAuctions(countrycode): cachename = 'TwkAuctions_'+ countrycode res = Cache.get(cachename) - if(res):return res + if(res): + return res response = requests.get("https://api.troostwijkauctions.com/sale/4/listgrouped?batchSize=99999&CountryIDs=" + countrycode) @@ -72,11 +72,13 @@ def getTwkAuctions(countrycode): def getOVMAuctions(): cachename = 'OnlineVeiling_' res = Cache.get(cachename) - if(res):return res + if(res): + return res response = requests.get("https://onlineveilingmeester.nl/rest/nl/veilingen?status=open&domein=ONLINEVEILINGMEESTER") if(response.status_code ==200): + print('Got Ovm Auctions') data = response.json() auctions = [] for result in data['veilingen']: