Files
fleabay/fleabay/definitions.py

59 lines
1.1 KiB
Python

from typing import Optional, Dict, Any
import attr
from immutabledict import immutabledict
@attr.s(auto_attribs=True)
class ItemSummary:
# arbitrary ID
id: str
href: str
name: str
condition: str
min_price: int
max_price: int
# None if not an auction
bids: Optional[int]
country: str
# None if postage not offered (collection only etc)
postage: Optional[int]
image_src: str
# extra data about the item.
extras: Dict[str, Any] = attr.attrib(factory=dict)
@attr.s(auto_attribs=True)
class MultiItemModelAxis:
code_name: str
# human_name: str
values: Dict[int, str]
@attr.s(auto_attribs=True)
class ItemDetails:
seller_name: str
seller_score: int
seller_percentage: str
axes: Dict[str, MultiItemModelAxis]
# variants: Dict[immutabledict[str, int]]
variants: Dict[immutabledict, int]
extra: Dict[str, Any] = attr.attrib(factory=dict)
codes_to_symbols = {
"GBP": "£",
"EUR": "",
"USD": "$",
"JPY": "¥"
}
@attr.s(auto_attribs=True)
class Price:
currency_code: str
amount: int