Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion bid_sniper.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ def __init__(self, config: Dict, dry_run: bool = False) -> None:
# if set, the default note to assign favorites that don't have a note
self.default_note = self.config["bid_sniper"].get("favorite_default_note", None)

self.date_format = "%Y-%m-%dT%H:%M:%S"

# logging setup
logging_conf = config.get("logging", dict())
self.logger = logging.getLogger("shopgoodwill_bid_sniper")
Expand Down Expand Up @@ -398,11 +400,19 @@ async def main_loop(self) -> None:
if item_id in self.scheduled_tasks:
continue

# SGW has been including microseconds inconsistently,
# and one is liable to see '2025-04-29T23:00:17.45' in
# the same response as '2025-05-01T22:09:00'
end_time = favorite_info["endTime"]
date_format = self.date_format
if "." in end_time:
date_format += ".%f"

# so close but yet so far away from ISO-8601
# SGW simply trims the "PDT" (or PST?) off of the timestamps
# TODO validate that the site only uses a single timezone!
end_time = (
datetime.datetime.fromisoformat(favorite_info["endTime"])
datetime.datetime.strptime(end_time, date_format)
.replace(tzinfo=ZoneInfo("US/Pacific"))
.astimezone(ZoneInfo("Etc/UTC"))
)
Expand Down