scrapy / parsel

Parsel lets you extract data from XML/HTML documents using XPath or CSS selectors
BSD 3-Clause "New" or "Revised" License
1.13k stars 144 forks source link

Why attrib() is the only one method that doesn't contain any checks? #284

Open beskrovniibv opened 12 months ago

beskrovniibv commented 12 months ago

https://github.com/scrapy/parsel/blob/047532793de5e35fbe1b302b91b63291721ee8fd/parsel/selector.py#L856

While the other methods raised clear exceptions attrib() confused developers with built-in AttributeError when self.root has no attribute attrib.

wRAR commented 11 months ago

When does that happen? Is it only a problem for JSON selectors?