mirror of
https://github.com/Second-Hand-Friends/kleinanzeigen-bot.git
synced 2026-03-12 10:31:50 +01:00
Fix #61 price_type NEGOTIABLE without price not supported
This commit is contained in:
@@ -241,7 +241,9 @@ class KleinanzeigenBot(SeleniumMixin):
|
|||||||
assert_min_len("title", 10)
|
assert_min_len("title", 10)
|
||||||
assert_has_value("description")
|
assert_has_value("description")
|
||||||
assert_one_of("price_type", {"FIXED", "NEGOTIABLE", "GIVE_AWAY", "NOT_APPLICABLE"})
|
assert_one_of("price_type", {"FIXED", "NEGOTIABLE", "GIVE_AWAY", "NOT_APPLICABLE"})
|
||||||
if not ad_cfg["price_type"] in {"GIVE_AWAY", "NOT_APPLICABLE"}:
|
if ad_cfg["price_type"] == "GIVE_AWAY":
|
||||||
|
ensure(not safe_get(ad_cfg, "price"), f"-> [price] must not be specified for GIVE_AWAY ad @ [{ad_file}]")
|
||||||
|
elif ad_cfg["price_type"] == "FIXED":
|
||||||
assert_has_value("price")
|
assert_has_value("price")
|
||||||
assert_one_of("shipping_type", {"PICKUP", "SHIPPING", "NOT_APPLICABLE"})
|
assert_one_of("shipping_type", {"PICKUP", "SHIPPING", "NOT_APPLICABLE"})
|
||||||
assert_has_value("contact.name")
|
assert_has_value("contact.name")
|
||||||
@@ -419,7 +421,7 @@ class KleinanzeigenBot(SeleniumMixin):
|
|||||||
price_type = ad_cfg["price_type"]
|
price_type = ad_cfg["price_type"]
|
||||||
if price_type != "NOT_APPLICABLE":
|
if price_type != "NOT_APPLICABLE":
|
||||||
self.web_select(By.XPATH, "//select[@id='priceType']", price_type)
|
self.web_select(By.XPATH, "//select[@id='priceType']", price_type)
|
||||||
if price_type != "GIVE_AWAY":
|
if safe_get(ad_cfg, "price"):
|
||||||
self.web_input(By.ID, "pstad-price", ad_cfg["price"])
|
self.web_input(By.ID, "pstad-price", ad_cfg["price"])
|
||||||
|
|
||||||
#############################
|
#############################
|
||||||
|
|||||||
Reference in New Issue
Block a user