mirror of
https://github.com/Second-Hand-Friends/kleinanzeigen-bot.git
synced 2026-03-12 10:31:50 +01:00
Extend/fix special attributes support (#35)
This commit is contained in:
@@ -253,7 +253,7 @@ login:
|
|||||||
|
|
||||||
#### 2) Ad configuration
|
#### 2) Ad configuration
|
||||||
|
|
||||||
Each ad is described in a separate JSON or YAML file.
|
Each ad is described in a separate JSON or YAML file with prefix `ad_<filename>`. The prefix is configurable in config file.
|
||||||
|
|
||||||
Parameter values specified in the `ad_defaults` section of the `config.yaml` file don't need to be specified again in the ad configuration file.
|
Parameter values specified in the `ad_defaults` section of the `config.yaml` file don't need to be specified again in the ad configuration file.
|
||||||
|
|
||||||
@@ -274,7 +274,7 @@ price:
|
|||||||
price_type: # one of: FIXED, NEGOTIABLE, GIVE_AWAY
|
price_type: # one of: FIXED, NEGOTIABLE, GIVE_AWAY
|
||||||
|
|
||||||
special_attributes:
|
special_attributes:
|
||||||
haus_mieten.zimmer_d: 5 # Zimmer
|
# haus_mieten.zimmer_d: value # Zimmer
|
||||||
|
|
||||||
shipping_type: # one of: PICKUP, SHIPPING, NOT_APPLICABLE
|
shipping_type: # one of: PICKUP, SHIPPING, NOT_APPLICABLE
|
||||||
|
|
||||||
|
|||||||
@@ -408,8 +408,24 @@ class KleinanzeigenBot(SeleniumMixin):
|
|||||||
# set special properties of category
|
# set special properties of category
|
||||||
#############################
|
#############################
|
||||||
if ad_cfg["special_attributes"]:
|
if ad_cfg["special_attributes"]:
|
||||||
for special_property_key, special_property_value in ad_cfg["special_attributes"]:
|
LOG.debug('found %i special attributes', len(ad_cfg["special_attributes"]))
|
||||||
self.web_input(By.ID, special_property_key, special_property_value)
|
for special_property_key, special_property_value in ad_cfg["special_attributes"].items():
|
||||||
|
LOG.debug("trying to add special attribute %s: %s ", special_property_key, special_property_value)
|
||||||
|
try:
|
||||||
|
self.web_select(By.XPATH, "//select[@id='" + special_property_key + "']", special_property_value)
|
||||||
|
LOG.debug("Successfully set attribute field '%s': '%s' ", special_property_key, special_property_value)
|
||||||
|
except BaseException:
|
||||||
|
LOG.debug("attribute field '%s' is not of kind dropdown, trying to input as plain text ", special_property_key)
|
||||||
|
try:
|
||||||
|
self.web_input(By.ID, special_property_key, special_property_value)
|
||||||
|
LOG.debug("Successfully set attribute field '%s': '%s' ", special_property_key, special_property_value)
|
||||||
|
except BaseException:
|
||||||
|
LOG.debug("attribute field '%s' is not of kind plain text, trying to input as radio button ", special_property_key)
|
||||||
|
try:
|
||||||
|
self.web_click(By.XPATH, "//*[@id='" + special_property_key + "']/option[@value='" + special_property_value + "']")
|
||||||
|
LOG.debug("Successfully set attribute field '%s': '%s' ", special_property_key, special_property_value)
|
||||||
|
except BaseException:
|
||||||
|
LOG.debug("attribute field '%s' is not of kind radio button. No more options. Wasn't able to set attribute ", special_property_key)
|
||||||
|
|
||||||
#############################
|
#############################
|
||||||
# set description
|
# set description
|
||||||
|
|||||||
@@ -26,3 +26,39 @@ Gesundheit: 153/224/gesundheit
|
|||||||
Tauschen: 272/273
|
Tauschen: 272/273
|
||||||
Verleihen: 272/274
|
Verleihen: 272/274
|
||||||
Verschenken: 272/192
|
Verschenken: 272/192
|
||||||
|
|
||||||
|
# Schuhe
|
||||||
|
Weiteres_Mode_Beauty: 153/155
|
||||||
|
Ballerinas: 153/159/ballerinas
|
||||||
|
Halb_Schnuerschuhe: 153/159/halb_schnuerschuhe
|
||||||
|
Hausschuhe: 153/159/hausschuhe
|
||||||
|
Outdoor_Wanderschuhe: 153/159/outdoor_wanderschuhe
|
||||||
|
Pumps_High_Heels: 153/159/pumps
|
||||||
|
Sandalen: 153/159/sandalen
|
||||||
|
Sneaker_Sportschuhe: 153/159/sneaker_sportschuhe
|
||||||
|
Stiefel_Stiefeletten: 153/159/stiefel
|
||||||
|
Weitere_Schuhe: 153/159/sonstiges
|
||||||
|
|
||||||
|
#Familie, Kind & Baby
|
||||||
|
Altenpflege: 17/236
|
||||||
|
Weiteres_Familie_Kind_Baby: 17/18
|
||||||
|
Kinderwagen_Buggys: 17/25
|
||||||
|
Babysitter_Kinderbetreuung: 17/237
|
||||||
|
Babyschalen_Kindersitze: 17/21
|
||||||
|
Baby_Ausstattung: 17/258
|
||||||
|
|
||||||
|
# Spielzeug
|
||||||
|
Action_Spielfiguren: 17/23/actionfiguren
|
||||||
|
Babyspielzeug: 17/23/babyspielzeug
|
||||||
|
Barbie_Co: 17/23/barbie
|
||||||
|
Dreirad_Co: 17/23/dreirad
|
||||||
|
Gesellschaftsspiele: 17/23/gesellschaftsspiele
|
||||||
|
Holzspielzeug: 17/23/holzspielzeug
|
||||||
|
LEGO_Duplo: 17/23/lego_duplo
|
||||||
|
Lernspielzeug: 17/23/lernspielzeug
|
||||||
|
Playmobil: 17/23/playmobil
|
||||||
|
Puppen: 17/23/puppen
|
||||||
|
Spielzeugautos: 17/23/spielzeug_autos
|
||||||
|
Spielzeug_draussen: 17/23/spielzeug_draussen
|
||||||
|
Stofftiere: 17/23/stofftiere
|
||||||
|
Weiteres_Spielzeug: 17/23/sonstiges
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ max-attributes = 10
|
|||||||
max-branches = 20
|
max-branches = 20
|
||||||
max-locals = 30
|
max-locals = 30
|
||||||
max-returns = 10
|
max-returns = 10
|
||||||
max-statements = 70
|
max-statements = 80
|
||||||
|
|
||||||
|
|
||||||
#####################
|
#####################
|
||||||
|
|||||||
Reference in New Issue
Block a user