has added RamiLevi to the chains collection
This commit is contained in:
11
co_op.py
11
co_op.py
@@ -8,20 +8,25 @@ from supermarket_chain import SupermarketChain
|
||||
|
||||
|
||||
class CoOp(SupermarketChain):
|
||||
|
||||
promotion_tag_name = 'Sale'
|
||||
promotion_update_tag_name = 'PriceUpdateDate'
|
||||
date_format = '%Y/%m/%d'
|
||||
date_hour_format = '%Y/%m/%d %H:%M:%S'
|
||||
item_tag_name = 'Product'
|
||||
|
||||
@property
|
||||
def update_date_format(self):
|
||||
return CoOp.date_hour_format
|
||||
|
||||
@staticmethod
|
||||
def get_download_url(store_id: int, category: SupermarketChain.XMLFilesCategory) -> str:
|
||||
def get_download_url(store_id: int, category: SupermarketChain.XMLFilesCategory, session: requests.Session) -> str:
|
||||
prefix = "http://matrixcatalog.co.il/"
|
||||
url = prefix + "NBCompetitionRegulations.aspx"
|
||||
req_res: requests.Response = requests.get(url)
|
||||
soup = BeautifulSoup(req_res.text, features='lxml')
|
||||
suffix: str = soup.find('a', href=lambda value: value and category.name.replace('s', '') in value
|
||||
and f'-{store_id:03d}-20' in value).attrs['href']
|
||||
and f'-{store_id:03d}-20' in value).attrs['href']
|
||||
down_url = prefix + suffix
|
||||
print(down_url)
|
||||
return down_url
|
||||
@@ -30,7 +35,7 @@ class CoOp(SupermarketChain):
|
||||
All, Promos, PromosFull, Prices, PricesFull, Stores = range(6)
|
||||
|
||||
def __repr__(self):
|
||||
return 'Co-Op'
|
||||
return 'CoOp'
|
||||
|
||||
@staticmethod
|
||||
def get_items(promo: Tag, items_dict: Dict[str, Item]) -> List[Item]:
|
||||
|
Reference in New Issue
Block a user