From b1737839ceb2d659f491b99440b278406dd8c7e3 Mon Sep 17 00:00:00 2001 From: korenlazar Date: Tue, 4 Oct 2022 12:09:42 +0300 Subject: [PATCH] Fixed bug with Shufersal Scraping by changing xml files category back to normal Enum. --- chains/cerberus_web_client.py | 2 +- supermarket_chain.py | 11 +++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/chains/cerberus_web_client.py b/chains/cerberus_web_client.py index c5e3499..ea92efe 100644 --- a/chains/cerberus_web_client.py +++ b/chains/cerberus_web_client.py @@ -41,7 +41,7 @@ class CerberusWebClient(SupermarketChain): time.sleep(2) searchElem = driver.find_element(By.CLASS_NAME, "form-control") - searchElem.send_keys(category.value) + searchElem.send_keys(category.value.lower().replace('s', '')) time.sleep(5) conns = driver.find_elements(By.CLASS_NAME, "f") diff --git a/supermarket_chain.py b/supermarket_chain.py index f721776..09cf8c1 100644 --- a/supermarket_chain.py +++ b/supermarket_chain.py @@ -3,7 +3,7 @@ from argparse import ArgumentTypeError from typing import Dict, List import requests -from aenum import StrEnum +from aenum import Enum from bs4.element import Tag from item import Item @@ -19,17 +19,12 @@ class SupermarketChain(object, metaclass=Meta): A class representing a supermarket chain. """ - class XMLFilesCategory(StrEnum): + class XMLFilesCategory(Enum): """ An enum class of different XML files produced by a supermarket chain """ - All = ("All",) - Prices = ("price",) - PricesFull = ("pricefull",) - Promos = ("promo",) - PromosFull = ("promofull",) - Stores = "store" + All, Prices, PricesFull, Promos, PromosFull, Stores = range(6) _promotion_tag_name = "Promotion" _promotion_update_tag_name = "PromotionUpdateDate"