diff --git a/src/python_picnic_api2/helper.py b/src/python_picnic_api2/helper.py index 971bb39..5954fe9 100644 --- a/src/python_picnic_api2/helper.py +++ b/src/python_picnic_api2/helper.py @@ -9,9 +9,7 @@ last = "└── " IMAGE_SIZES = ["small", "medium", "regular", "large", "extra-large"] -IMAGE_BASE_URL = ( - "https://storefront-prod.nl.picnicinternational.com/static/images" -) +IMAGE_BASE_URL = "https://storefront-prod.nl.picnicinternational.com/static/images" SOLE_ARTICLE_ID_PATTERN = re.compile(r'"sole_article_id":"(\w+)"') @@ -95,10 +93,7 @@ def find_articles(node): return content = node.get("content", {}) - if ( - content.get("type") == "SELLING_UNIT_TILE" - and "sellingUnit" in content - ): + if content.get("type") == "SELLING_UNIT_TILE" and "sellingUnit" in content: selling_unit = content["sellingUnit"] sole_article_ids = SOLE_ARTICLE_ID_PATTERN.findall(json.dumps(node)) sole_article_id = sole_article_ids[0] if sole_article_ids else None @@ -111,6 +106,9 @@ def find_articles(node): for child in node.get("children", []): find_articles(child) + if "child" in node: + find_articles(node.get("child")) + body = raw_results.get("body", {}) find_articles(body.get("child", {}))