From 8958a9aed079f03a19b219e57e66d14b5a600808 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20=C5=81ozi=C5=84ski?= <42167605+Dakse@users.noreply.github.com> Date: Thu, 1 Jun 2023 17:31:04 +0200 Subject: [PATCH] Updated to work with v2 api --- lidlplus/api.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lidlplus/api.py b/lidlplus/api.py index 7ee2cb4..44f25e0 100644 --- a/lidlplus/api.py +++ b/lidlplus/api.py @@ -37,7 +37,7 @@ class LidlPlusApi: _CLIENT_ID = "LidlPlusNativeClient" _AUTH_API = "https://accounts.lidl.com" - _TICKET_API = "https://tickets.lidlplus.com/api/v1" + _TICKET_API = "https://tickets.lidlplus.com/api/v2" _APP = "com.lidlplus.app" _OS = "iOs" _TIMEOUT = 10 @@ -239,12 +239,12 @@ def _default_headers(self): def tickets(self): """Get list of all tickets""" - url = f"{self._TICKET_API}/{self._country}/list" + url = f"{self._TICKET_API}/{self._country}/tickets" kwargs = {"headers": self._default_headers(), "timeout": self._TIMEOUT} - ticket = requests.get(f"{url}/1", **kwargs).json() - tickets = ticket["records"] + ticket = requests.get(f"{url}?pageNumber=1", **kwargs).json() + tickets = ticket["tickets"] for i in range(2, int(ticket["totalCount"] / ticket["size"] + 2)): - tickets += requests.get(f"{url}/{i}", **kwargs).json()["records"] + tickets += requests.get(f"{url}?pageNumber={i}", **kwargs).json()["tickets"] return tickets def ticket(self, ticket_id):