From 927ab9d5c860830144f01e00efb628f53274a366 Mon Sep 17 00:00:00 2001 From: Alex Laird Date: Sun, 27 Oct 2024 10:53:47 -0500 Subject: [PATCH] Fix mypy annotation issue. --- amazonorders/entity/order.py | 2 +- amazonorders/orders.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/amazonorders/entity/order.py b/amazonorders/entity/order.py index 25630fb..97d531c 100644 --- a/amazonorders/entity/order.py +++ b/amazonorders/entity/order.py @@ -157,7 +157,7 @@ def _parse_recipient(self) -> Recipient: value = util.select_one(self.parsed, self.config.selectors.FIELD_ORDER_ADDRESS_FALLBACK_1_SELECTOR) if value: - data_popover = value.get("data-a-popover", {}) # type: ignore[arg-type] + data_popover = value.get("data-a-popover", {}) # type: ignore[var-annotated] inline_content = data_popover.get("inlineContent") # type: ignore[union-attr] if inline_content: value = BeautifulSoup(json.loads(inline_content), "html.parser") diff --git a/amazonorders/orders.py b/amazonorders/orders.py index 526bb36..8e24012 100644 --- a/amazonorders/orders.py +++ b/amazonorders/orders.py @@ -76,6 +76,12 @@ def get_order_history(self, order: Order = self.config.order_cls(order_tag, self.config) if full_details: + if not order.order_details_link: + logger.warning(f"order_details_link for Order {order.order_number} did not populate, " + f"cannot read full details.") + + continue + self.amazon_session.get(order.order_details_link) order_details_tag = util.select_one(self.amazon_session.last_response_parsed, self.config.selectors.ORDER_DETAILS_ENTITY_SELECTOR)