Made twk auctions show on all locations
This commit is contained in:
@@ -51,27 +51,31 @@ def getTwkAuctions(countrycode):
|
|||||||
|
|
||||||
for twka in data['pageProps']['listData']:
|
for twka in data['pageProps']['listData']:
|
||||||
# print(twka['urlSlug'])
|
# print(twka['urlSlug'])
|
||||||
auction = getTWKAuction(twkDataUrl, twka['urlSlug'])
|
auctionlocations = getTWKAuction(twka)
|
||||||
if(auction):
|
for auction in auctionlocations:
|
||||||
auctions.append(auction)
|
auctions.append(auction)
|
||||||
|
|
||||||
Cache.add(cachename, auctions)
|
Cache.add(cachename, auctions)
|
||||||
|
|
||||||
return auctions
|
return auctions
|
||||||
return []
|
return []
|
||||||
|
|
||||||
def getTWKAuction(twkDataUrl, auctionurlslug):
|
def getTWKAuction(twka):
|
||||||
log("getting TWK auctiondetails:" + twkDataUrl + "a/" + auctionurlslug + ".json")
|
locations = []
|
||||||
response = requests.get(twkDataUrl + "a/" + auctionurlslug + '.json')
|
cities = []
|
||||||
if(response.status_code == 200):
|
|
||||||
data = response.json()
|
|
||||||
if(len(data['pageProps']['lots']['results']) ==0):
|
|
||||||
return None
|
|
||||||
|
|
||||||
twka = data['pageProps']['auction']
|
if(len(twka['collectionDays'])>0):
|
||||||
firstlot = data['pageProps']['lots']['results'][0]
|
cities = twka['collectionDays']
|
||||||
city = "Nederland" if firstlot['location']['city'].lower() == 'online' or firstlot['location']['city'].lower() == "free delivery" else firstlot['location']['city']
|
elif(len(twka['deliveryCountries']) >0):
|
||||||
a = Auction(Auctionbrand.TWK, city, firstlot['location']['countryCode'].upper(), twka['name'], datetime.fromtimestamp(twka['startDate']), datetime.fromtimestamp(twka['minEndDate']), '/a/' + auctionurlslug, twka['image']['url'], twka['lotCount'] )
|
cities = [{ 'countryCode': 'nl', 'city':'Nederland'}]
|
||||||
# print(a);
|
|
||||||
return a
|
|
||||||
|
|
||||||
return None
|
image = ''
|
||||||
|
if(len(twka['images']) > 0 and twka['images'][0]['url']):
|
||||||
|
image = twka['images'][0]['url']
|
||||||
|
|
||||||
|
for city in cities:
|
||||||
|
if(city['countryCode'].upper() != 'NL'): continue
|
||||||
|
a = Auction(Auctionbrand.TWK, city['city'], city['countryCode'].upper(), twka['name'], datetime.fromtimestamp(twka['startDate']), datetime.fromtimestamp(twka['minEndDate']), '/a/' + twka['urlSlug'], image, twka['lotCount'], None, len(cities) > 1 )
|
||||||
|
locations.append(a)
|
||||||
|
|
||||||
|
return locations
|
||||||
Reference in New Issue
Block a user