mirror of
https://github.com/Second-Hand-Friends/kleinanzeigen-bot.git
synced 2026-03-12 10:31:50 +01:00
feat: support shipping for WANTED ads #349
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
|
||||
@@ -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"]')
|
||||
|
||||
Reference in New Issue
Block a user