mirror of
https://github.com/Second-Hand-Friends/kleinanzeigen-bot.git
synced 2026-03-12 10:31:50 +01:00
CHANGE assertion to ValueError
This commit is contained in:
committed by
Sebastian Thomschke
parent
06b947b0fc
commit
eca782c0be
@@ -45,7 +45,11 @@ class AdExtractor:
|
|||||||
belen_conf = self.driver.execute_script("return window.BelenConf")
|
belen_conf = self.driver.execute_script("return window.BelenConf")
|
||||||
special_attributes_str = belen_conf["universalAnalyticsOpts"]["dimensions"]["dimension108"]
|
special_attributes_str = belen_conf["universalAnalyticsOpts"]["dimensions"]["dimension108"]
|
||||||
special_attributes = json.loads(special_attributes_str)
|
special_attributes = json.loads(special_attributes_str)
|
||||||
assert isinstance(special_attributes, dict)
|
if not isinstance(special_attributes, dict):
|
||||||
|
raise ValueError(
|
||||||
|
"Failed to parse special attributes from ad page."
|
||||||
|
f"Expected a dictionary, but got a {type(special_attributes)}"
|
||||||
|
)
|
||||||
special_attributes = {k: v for k, v in special_attributes.items() if not k.endswith('.versand_s')}
|
special_attributes = {k: v for k, v in special_attributes.items() if not k.endswith('.versand_s')}
|
||||||
return special_attributes
|
return special_attributes
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user