all
This commit is contained in:
@@ -3,11 +3,13 @@ import enum
|
||||
from json import JSONEncoder
|
||||
import json
|
||||
|
||||
|
||||
class Countrycode(Enum):
|
||||
NL = "NL",
|
||||
DE = "DE",
|
||||
BE = "BE"
|
||||
|
||||
|
||||
class Auctionbrand(str, Enum):
|
||||
NONE = "NONE",
|
||||
TWK = "TWK"
|
||||
@@ -16,7 +18,8 @@ class Auctionbrand(str, Enum):
|
||||
|
||||
|
||||
class GeonameLocation:
|
||||
def __init__(self, geonameid = 0, name = "", asciiname = "", alternatenames = [], latitude = 0, longitude = 0, countrycode:Countrycode = Countrycode.NL, modificationdate = "") :
|
||||
def __init__(self, geonameid=0, name="", asciiname="", alternatenames=[], latitude=0, longitude=0,
|
||||
countrycode: Countrycode = Countrycode.NL, modificationdate=""):
|
||||
self.geonameid = geonameid
|
||||
self.name = name
|
||||
self.asciiname = asciiname
|
||||
@@ -26,16 +29,20 @@ class GeonameLocation:
|
||||
self.countrycode = countrycode
|
||||
self.modificationdate = modificationdate
|
||||
|
||||
|
||||
class Maplocation:
|
||||
def __init__(self, lat = 0, long = 0, numberofauctions = 0, geonamelocation:GeonameLocation = None, auctions = []):
|
||||
def __init__(self, lat=0, long=0, numberofauctions=0, geonamelocation: GeonameLocation = None, auctions=[]):
|
||||
self.lat = lat
|
||||
self.long = long
|
||||
self.numberofauctions = numberofauctions
|
||||
self.geonamelocation = geonamelocation
|
||||
self.auctions = auctions
|
||||
|
||||
class Auction:
|
||||
def __init__(self, auctionbrand: Auctionbrand = Auctionbrand.NONE, city = "", countrycode:Countrycode = Countrycode.NL, name = "", starttime = None, closingtime = None, url = "", imageurl = "", numberoflots = 0, geonamelocation: GeonameLocation = None, multiplelocations = False):
|
||||
|
||||
class Auction:
|
||||
def __init__(self, auctionbrand: Auctionbrand = Auctionbrand.NONE, city="", countrycode: Countrycode = Countrycode.NL, name="",
|
||||
starttime=None, closingtime=None, url="", imageurl="", numberoflots=0, geonamelocation: GeonameLocation = None,
|
||||
multiplelocations=False):
|
||||
self.city = city
|
||||
self.countrycode = countrycode
|
||||
self.name = name
|
||||
@@ -48,10 +55,11 @@ class Auction:
|
||||
self.brand = auctionbrand
|
||||
self.multiplelocations = multiplelocations
|
||||
|
||||
|
||||
class JsonEncoder(JSONEncoder):
|
||||
# def default(self, o):
|
||||
# return o.__dict__
|
||||
#try 2
|
||||
# try 2
|
||||
def default(self, obj):
|
||||
# Only serialize public, instance-level attributes
|
||||
if hasattr(obj, '__dict__'):
|
||||
@@ -76,4 +84,4 @@ class JsonEncoder(JSONEncoder):
|
||||
json.dumps(value)
|
||||
return value
|
||||
except (TypeError, OverflowError):
|
||||
return str(value)
|
||||
return str(value)
|
||||
|
||||
Reference in New Issue
Block a user