Added onlineveilingmeester auctions

This commit is contained in:
Computerboer
2023-07-09 20:38:13 +02:00
parent ae76936544
commit 96b4cdc0ea
3 changed files with 39 additions and 4 deletions

View File

@@ -13,7 +13,7 @@
<Name>Auctionviewer.api</Name> <Name>Auctionviewer.api</Name>
<RootNamespace>PythonAuctionviewer</RootNamespace> <RootNamespace>PythonAuctionviewer</RootNamespace>
<IsWindowsApplication>False</IsWindowsApplication> <IsWindowsApplication>False</IsWindowsApplication>
<InterpreterId>Global|PythonCore|3.6-32</InterpreterId> <InterpreterId>MSBuild|virtEnv_1|$(MSBuildProjectFullPath)</InterpreterId>
<LaunchProvider>Standard Python launcher</LaunchProvider> <LaunchProvider>Standard Python launcher</LaunchProvider>
<EnableNativeCodeDebugging>True</EnableNativeCodeDebugging> <EnableNativeCodeDebugging>True</EnableNativeCodeDebugging>
<SuppressPackageInstallationPrompt>True</SuppressPackageInstallationPrompt> <SuppressPackageInstallationPrompt>True</SuppressPackageInstallationPrompt>
@@ -47,6 +47,17 @@
<Folder Include="data\" /> <Folder Include="data\" />
<Folder Include="utils\" /> <Folder Include="utils\" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Interpreter Include="virtEnv_1\">
<Id>virtEnv_1</Id>
<Version>3.11</Version>
<Description>virtEnv_1 (Python 3.11 (64-bit))</Description>
<InterpreterPath>Scripts\python.exe</InterpreterPath>
<WindowsInterpreterPath>Scripts\pythonw.exe</WindowsInterpreterPath>
<PathEnvironmentVariable>PYTHONPATH</PathEnvironmentVariable>
<Architecture>X64</Architecture>
</Interpreter>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Python Tools\Microsoft.PythonTools.targets" /> <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Python Tools\Microsoft.PythonTools.targets" />
<!-- Uncomment the CoreCompile target to enable the Build command in <!-- Uncomment the CoreCompile target to enable the Build command in
Visual Studio and specify your pre- and post-build commands in Visual Studio and specify your pre- and post-build commands in

View File

@@ -9,6 +9,7 @@ class Countrycode(Enum):
class Auctionbrand(str, Enum): class Auctionbrand(str, Enum):
NONE = "NONE", NONE = "NONE",
TWK = "TWK" TWK = "TWK"
OVM = "OVM"
class GeonameLocation: class GeonameLocation:

View File

@@ -1,3 +1,4 @@
from asyncio.windows_events import NULL
import requests import requests
from cache import Cache from cache import Cache
from models.location import Auction, Auctionbrand, Countrycode, Maplocation from models.location import Auction, Auctionbrand, Countrycode, Maplocation
@@ -10,7 +11,10 @@ def getAuctionlocations(countrycode: Countrycode):
res = Cache.get(cachename) res = Cache.get(cachename)
if(res): return res if(res): return res
auctions = getTwkAuctions(countrycode)
twkauctions = getTwkAuctions(countrycode)
ovmauctions = getOVMAuctions()
auctions = [*twkauctions, *ovmauctions]
for auction in auctions: for auction in auctions:
auction.geonamelocation = getGeoLocationByCity(auction.city, countrycode) auction.geonamelocation = getGeoLocationByCity(auction.city, countrycode)
@@ -47,11 +51,11 @@ def get_geonameid(auction):
def getTwkAuctions(countrycode): def getTwkAuctions(countrycode):
cachename = 'TwkAuctions_'+ countrycode cachename = 'TwkAuctions_'+ countrycode
response = requests.get("https://api.troostwijkauctions.com/sale/4/listgrouped?batchSize=99999&CountryIDs=" + countrycode)
res = Cache.get(cachename) 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)
if(response.status_code ==200): if(response.status_code ==200):
print('Got Twk Auctions') print('Got Twk Auctions')
data = response.json(); data = response.json();
@@ -64,3 +68,22 @@ def getTwkAuctions(countrycode):
return auctions return auctions
return None return None
def getOVMAuctions():
cachename = 'OnlineVeiling_'
res = Cache.get(cachename)
if(res):return res
response = requests.get("https://onlineveilingmeester.nl/rest/nl/veilingen?status=open&domein=ONLINEVEILINGMEESTER")
if(response.status_code ==200):
data = response.json()
auctions = []
for result in data['veilingen']:
cityname ="Nederland" if result['isBezorgVeiling'] else result['afgifteAdres']['plaats']
cityname = "Nederland" if cityname is None else cityname #there can be auctions where you have to make an appointment to retrieve the lots
a = Auction(Auctionbrand.OVM, cityname,result['land'], result['naam'],result['openingsDatumISO'], result['sluitingsDatumISO'], str(result['land']).lower() + '/veilingen/' + str(result['id']) + '/kavels', 'images/150x150/' + str(result['id']) + '/' + result['image'], result['totaalKavels'] )
auctions.append(a)
Cache.add(cachename, auctions)
return auctions
return None