|
1 | 1 | """
|
2 | 2 | Lidl Plus api
|
3 | 3 | """
|
| 4 | + |
4 | 5 | import base64
|
5 | 6 | import html
|
6 | 7 | import logging
|
@@ -40,6 +41,7 @@ class LidlPlusApi:
|
40 | 41 | _AUTH_API = "https://accounts.lidl.com"
|
41 | 42 | _TICKET_API = "https://tickets.lidlplus.com/api/v2"
|
42 | 43 | _COUPONS_API = "https://coupons.lidlplus.com/api"
|
| 44 | + _COUPONS_V1_API = "https://coupons.lidlplus.com/app/api/" |
43 | 45 | _PROFILE_API = "https://profile.lidlplus.com/profile/api"
|
44 | 46 | _APP = "com.lidlplus.app"
|
45 | 47 | _OS = "iOs"
|
@@ -269,6 +271,18 @@ def ticket(self, ticket_id):
|
269 | 271 | url = f"{self._TICKET_API}/{self._country}/tickets"
|
270 | 272 | return requests.get(f"{url}/{ticket_id}", **kwargs).json()
|
271 | 273 |
|
| 274 | + def coupon_promotions_v1(self): |
| 275 | + """Get list of all coupons API V1""" |
| 276 | + url = f"{self._COUPONS_V1_API}/v1/promotionslist" |
| 277 | + kwargs = {"headers": {**self._default_headers(), "Country": self._country}, "timeout": self._TIMEOUT} |
| 278 | + return requests.get(url, **kwargs).json() |
| 279 | + |
| 280 | + def activate_coupon_promotion_v1(self, promotion_id): |
| 281 | + """Activate single coupon by id API V1""" |
| 282 | + url = f"{self._COUPONS_V1_API}/v1/promotions/{promotion_id}/activation" |
| 283 | + kwargs = {"headers": {**self._default_headers(), "Country": self._country}, "timeout": self._TIMEOUT} |
| 284 | + return requests.post(url, **kwargs) |
| 285 | + |
272 | 286 | def coupons(self):
|
273 | 287 | """Get list of all coupons"""
|
274 | 288 | url = f"{self._COUPONS_API}/v2/{self._country}"
|
|
0 commit comments