diff --git a/pyproject.toml b/pyproject.toml index ccc2fd3..a2aec24 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -216,10 +216,10 @@ notes = [ "FIXME", "XXX", "TODO" ] # list of note tags to take in consideration # https://pylint.pycqa.org/en/latest/user_guide/configuration/all-options.html#design-checker # https://pylint.pycqa.org/en/latest/user_guide/checkers/features.html#design-checker-messages max-attributes = 15 # maximum number of instance attributes for a class (R0902) -max-branches = 30 # maximum number of branch for function / method body (R0912) +max-branches = 40 # maximum number of branch for function / method body (R0912) max-locals = 30 # maximum number of local variables for function / method body (R0914) max-returns = 10 # maximum number of return / yield for function / method body (R0911) -max-statements = 100 # maximum number of statements in function / method body (R0915) +max-statements = 150 # maximum number of statements in function / method body (R0915) max-public-methods = 30 # maximum number of public methods for a class (R0904) diff --git a/src/kleinanzeigen_bot/__init__.py b/src/kleinanzeigen_bot/__init__.py index a56c3c4..57ee2e4 100644 --- a/src/kleinanzeigen_bot/__init__.py +++ b/src/kleinanzeigen_bot/__init__.py @@ -528,7 +528,15 @@ class KleinanzeigenBot(WebScrapingMixin): ############################# # set shipping type/options/costs ############################# - if ad_cfg["shipping_type"] == "PICKUP": + if ad_cfg["type"] == "WANTED": + # special handling for ads of type WANTED since shipping is a special attribute for these + if ad_cfg["shipping_type"] in {"PICKUP", "SHIPPING"}: + shipping_value = "ja" if ad_cfg["shipping_type"] == "SHIPPING" else "nein" + try: + await self.web_select(By.XPATH, "//select[contains(@id, '.versand_s')]", shipping_value) + except TimeoutError: + LOG.warning("Failed to set shipping attribute for type '%s'!", ad_cfg['shipping_type']) + elif ad_cfg["shipping_type"] == "PICKUP": try: await self.web_click(By.XPATH, '//*[contains(@class, "ShippingPickupSelector")]//label[text()[contains(.,"Nur Abholung")]]/input[@type="radio"]')