documented YahooAuctionsItem

This commit is contained in:
Lynne Megido 2020-08-23 20:03:08 +10:00
parent f0cfa46f28
commit 1e2b3902f2
Signed by: lynnesbian
GPG key ID: F0A184B5213D9F90

View file

@ -8,6 +8,51 @@ import functions
JST = timezone(timedelta(hours = 9)) JST = timezone(timedelta(hours = 9))
class YahooAuctionsItem: class YahooAuctionsItem:
"""
A class for handling items on Yahoo! Auctions Japan
Attributes
----------
name : str
The name given to the auction item by the user.
original_name : str
The name as it appears on Y!A,
favourite : bool
Whether or not the user has "favourited" this item.
url : bool
The URL this item was added from. If not provided, defaults to https://buyee.jp/item/yahoo/auction/{id}.
id : str
The ID of the item, found at the end of the URL.
last_checked : datetime
The time that the item's status was last checked by buypeeb.
available : bool
Whether or not the item is still available (if the auction is still available)
ready : bool
Whether or not the object is ready. If not, some of the data (price, available, etc.) may be out of date or unset.
updating : bool
If true, the object is currently being updated. Should never be true if ready is true.
price : float
The price of the item in yen.
bids : int
The number of bids that have been placed on the item.
start_date : datetime
The start date and time of the item in JST.
end_date : datetime
The end date and time of the item in JST.
"""
def __init__(self, url: str, id: str, name: str = None, from_json: dict = None): def __init__(self, url: str, id: str, name: str = None, from_json: dict = None):
# note - incoming url is not validated in any way! # note - incoming url is not validated in any way!
self.name = name self.name = name
@ -27,6 +72,8 @@ class YahooAuctionsItem:
self.last_checked = datetime.fromisoformat('1970-01-01') self.last_checked = datetime.fromisoformat('1970-01-01')
self.available = True self.available = True
self.ready = False
self.updating = False
self.update() self.update()
def update(self): def update(self):