feat: add version to banner (#560)

This commit is contained in:
Jens Bergmann
2025-06-22 21:11:13 +02:00
committed by GitHub
parent 55776f3ff6
commit c3499b3824
2 changed files with 9 additions and 7 deletions

View File

@@ -833,7 +833,7 @@ class KleinanzeigenBot(WebScrapingMixin):
img_items = await self.web_find_all(By.CSS_SELECTOR, img_items = await self.web_find_all(By.CSS_SELECTOR,
"ul#j-pictureupload-thumbnails > li.ui-sortable-handle") "ul#j-pictureupload-thumbnails > li.ui-sortable-handle")
for element in img_items: for element in img_items:
btn = await self.web_find(By.CSS_SELECTOR, "button.pictureupload-thumbnails-remove", parent=element) btn = await self.web_find(By.CSS_SELECTOR, "button.pictureupload-thumbnails-remove", parent = element)
await btn.click() await btn.click()
############################# #############################
@@ -1052,7 +1052,7 @@ class KleinanzeigenBot(WebScrapingMixin):
if mode == AdUpdateStrategy.MODIFY: if mode == AdUpdateStrategy.MODIFY:
try: try:
# when "Andere Versandmethoden" is not available, go back and start over new # when "Andere Versandmethoden" is not available, go back and start over new
await self.web_find(By.XPATH, '//*[contains(@class, "CarrierSelectionModal")]//button[contains(., "Andere Versandmethoden")]', timeout=2) await self.web_find(By.XPATH, '//*[contains(@class, "CarrierSelectionModal")]//button[contains(., "Andere Versandmethoden")]', timeout = 2)
except TimeoutError: except TimeoutError:
await self.web_click(By.XPATH, '//dialog//button[contains(., "Zurück")]') await self.web_click(By.XPATH, '//dialog//button[contains(., "Zurück")]')
@@ -1081,7 +1081,8 @@ class KleinanzeigenBot(WebScrapingMixin):
# only click on "Individueller Versand" when "IndividualShippingInput" is not available, otherwise its already checked # only click on "Individueller Versand" when "IndividualShippingInput" is not available, otherwise its already checked
# (important for mode = UPDATE) # (important for mode = UPDATE)
await self.web_find(By.XPATH, await self.web_find(By.XPATH,
'//*[contains(@class, "IndividualPriceSection")]//div[contains(@class, "IndividualShippingInput")]', timeout=2) '//*[contains(@class, "IndividualPriceSection")]//div[contains(@class, "IndividualShippingInput")]',
timeout = 2)
except TimeoutError: except TimeoutError:
await self.web_click(By.XPATH, '//*[contains(@id, "INDIVIDUAL") and contains(@data-testid, "Individueller Versand")]') await self.web_click(By.XPATH, '//*[contains(@id, "INDIVIDUAL") and contains(@data-testid, "Individueller Versand")]')
@@ -1298,7 +1299,7 @@ class KleinanzeigenBot(WebScrapingMixin):
def main(args:list[str]) -> None: def main(args:list[str]) -> None:
if "version" not in args: if "version" not in args:
print(textwrap.dedent(r""" print(textwrap.dedent(rf"""
_ _ _ _ _ _ _ _ _ _ _ _
| | _| | ___(_)_ __ __ _ _ __ _______(_) __ _ ___ _ __ | |__ ___ | |_ | | _| | ___(_)_ __ __ _ _ __ _______(_) __ _ ___ _ __ | |__ ___ | |_
| |/ / |/ _ \ | '_ \ / _` | '_ \|_ / _ \ |/ _` |/ _ \ '_ \ ____| '_ \ / _ \| __| | |/ / |/ _ \ | '_ \ / _` | '_ \|_ / _ \ |/ _` |/ _ \ '_ \ ____| '_ \ / _ \| __|
@@ -1306,6 +1307,7 @@ def main(args:list[str]) -> None:
|_|\_\_|\___|_|_| |_|\__,_|_| |_/___\___|_|\__, |\___|_| |_| |_.__/ \___/ \__| |_|\_\_|\___|_|_| |_|\__,_|_| |_/___\___|_|\__, |\___|_| |_| |_.__/ \___/ \__|
|___/ |___/
https://github.com/Second-Hand-Friends/kleinanzeigen-bot https://github.com/Second-Hand-Friends/kleinanzeigen-bot
Version: {__version__}
""")[1:], flush = True) # [1:] removes the first empty blank line """)[1:], flush = True) # [1:] removes the first empty blank line
loggers.configure_console_logging() loggers.configure_console_logging()

View File

@@ -433,7 +433,7 @@ class TestAdExtractorContent:
raw_description, # Raw description (without affixes) raw_description, # Raw description (without affixes)
"03.02.2025" # Creation date "03.02.2025" # Creation date
]), ]),
web_execute=AsyncMock(return_value={ web_execute = AsyncMock(return_value = {
"universalAnalyticsOpts": { "universalAnalyticsOpts": {
"dimensions": { "dimensions": {
"dimension92": "", "dimension92": "",
@@ -469,7 +469,7 @@ class TestAdExtractorContent:
TimeoutError("Timeout"), # Description times out TimeoutError("Timeout"), # Description times out
"03.02.2025" # Date succeeds "03.02.2025" # Date succeeds
]), ]),
web_execute=AsyncMock(return_value={ web_execute = AsyncMock(return_value = {
"universalAnalyticsOpts": { "universalAnalyticsOpts": {
"dimensions": { "dimensions": {
"dimension92": "", "dimension92": "",
@@ -604,7 +604,7 @@ class TestAdExtractorCategory:
@pytest.mark.asyncio @pytest.mark.asyncio
# pylint: disable=protected-access # pylint: disable=protected-access
async def test_extract_special_attributes_not_empty(self, extractor: AdExtractor) -> None: async def test_extract_special_attributes_not_empty(self, extractor:AdExtractor) -> None:
"""Test extraction of special attributes when not empty.""" """Test extraction of special attributes when not empty."""
special_atts = { special_atts = {