Has added Zol Vebengadol. Fixed small bug in Co-Op.

This commit is contained in:
KorenLazar
2020-12-26 17:18:21 +02:00
parent be47a5ad81
commit ee35e3436c
8 changed files with 124 additions and 16 deletions

View File

@@ -15,11 +15,13 @@ class ShuferSal(SupermarketChain):
@staticmethod
def get_download_url(store_id: int, category: SupermarketChain.XMLFilesCategory) -> str:
url = f"http://prices.shufersal.co.il/FileObject/UpdateCategory?catID={category.value}"
if SupermarketChain.is_valid_store_id(store_id):
if SupermarketChain.is_valid_store_id(int(store_id)):
url += f"&storeId={store_id}"
req_res: requests.Response = requests.get(url)
soup = BeautifulSoup(req_res.text, features='lxml')
return soup.find('a', text="לחץ להורדה")['href']
down_url = soup.find('a', text="לחץ להורדה")['href']
print(down_url)
return down_url
class XMLFilesCategory(SupermarketChain.XMLFilesCategory):
All, Prices, PricesFull, Promos, PromosFull, Stores = range(6)
@@ -29,5 +31,10 @@ class ShuferSal(SupermarketChain):
@staticmethod
def get_items(promo: Tag, items_dict: Dict[str, str]) -> List[str]:
return [items_dict.get(item.find('ItemCode').text) for item in promo.find_all('Item')
if items_dict.get(item.find('ItemCode').text)]
items = list()
for item in promo.find_all('Item'):
item_code = item.find('ItemCode').text
full_item_info = items_dict.get(item_code)
if full_item_info:
items.append(full_item_info)
return items