Skip to content

Commit b9bf9f2

Browse files
committed
fix: supply client version for cart operations
PicNic suddenly requires a client version for cart operations.
1 parent f6dc598 commit b9bf9f2

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/python_picnic_api2/client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def search(self, term: str) -> SearchResult:
176176
return SearchResult.from_page(raw_results)
177177

178178
def get_cart(self) -> Cart:
179-
return Cart.from_api(self._get("/cart"))
179+
return Cart.from_api(self._get("/cart", add_picnic_headers=True))
180180

181181
def get_article(self, article_id: str, add_category=False) -> Article | None:
182182
path = f"/pages/product-details-page-root?id={article_id}" + \
@@ -212,14 +212,14 @@ def get_article_category(self, article_id: str):
212212

213213
def add_product(self, product_id: str, count: int = 1) -> Cart:
214214
data = {"product_id": product_id, "count": count}
215-
return Cart.from_api(self._post("/cart/add_product", data))
215+
return Cart.from_api(self._post("/cart/add_product", data, add_picnic_headers=True))
216216

217217
def remove_product(self, product_id: str, count: int = 1) -> Cart:
218218
data = {"product_id": product_id, "count": count}
219-
return Cart.from_api(self._post("/cart/remove_product", data))
219+
return Cart.from_api(self._post("/cart/remove_product", data, add_picnic_headers=True))
220220

221221
def clear_cart(self) -> Cart:
222-
return Cart.from_api(self._post("/cart/clear"))
222+
return Cart.from_api(self._post("/cart/clear", add_picnic_headers=True))
223223

224224
def get_delivery_slots(self) -> DeliverySlots:
225225
return DeliverySlots.from_api(self._get("/cart/delivery_slots"))

0 commit comments

Comments
 (0)