Skip to content

Commit

Permalink
Merge pull request #5 from Dakse/main
Browse files Browse the repository at this point in the history
Updated to work with v2 api
  • Loading branch information
Andre0512 authored Jun 3, 2023
2 parents 9e20748 + 8958a9a commit fb3a144
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lidlplus/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit fb3a144

Please sign in to comment.