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: 5 additions & 7 deletions src/python_picnic_api2/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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+)"')

Expand Down Expand Up @@ -95,10 +93,7 @@
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
Expand All @@ -111,6 +106,9 @@
for child in node.get("children", []):
find_articles(child)

if "child" in node:
find_articles(node.get("child"))

Check warning on line 110 in src/python_picnic_api2/helper.py

View check run for this annotation

Codecov / codecov/patch

src/python_picnic_api2/helper.py#L110

Added line #L110 was not covered by tests

body = raw_results.get("body", {})
find_articles(body.get("child", {}))

Expand Down