4
4
import json
5
5
import asyncio
6
6
7
+
7
8
class Api :
8
9
def __init__ (self ):
9
10
self .addresses = None
@@ -24,15 +25,25 @@ async def get_addresses(self, postcode):
24
25
25
26
async def get_delivery_stores (self , full_address ):
26
27
stores_results = await self .fetch (['v2' , 'stores' ], params = {'searchType' : 'ALL' , 'locationType' : 'HOME' ,
27
- 'street' : full_address ['address1' ],
28
- 'city' : full_address ['city' ],
28
+ # 'street': full_address['address1'],
29
+ # 'city': full_address['city'],
29
30
'postalCode' : full_address ['postalCode' ]})
30
31
return stores_results ['data' ]['deliveryStores' ]
31
32
33
+ async def get_store_availability (self , store_id ):
34
+ availability = await self .fetch (['v2' , 'stores' , store_id , 'availability' ])
35
+ return availability ['data' ]
36
+
37
+ async def get_store_opening_hours (self , store_id ):
38
+ opening_hours = await self .fetch (['v2' , 'stores' , store_id ])
39
+ return opening_hours ['data' ]['storeHours' ]
40
+
32
41
async def get_store_deals (self , store_id ):
33
42
r = await self .fetch (['v2' , 'stores' , store_id , 'deals' , 'grouped' ], params = {'hideSteps' : 'true' })
34
43
return r ['data' ]['deals' ]
35
44
45
+
46
+
36
47
async def check_response (self , resp ):
37
48
if resp ['data' ]:
38
49
return resp
0 commit comments