I use:
class ProductPage(Item):
coupon = Attr('.coupon', 'title')
However some product pages do not contain the coupon html
so they fail with
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/htmlparsing.py", line 79, in parse
return element.css(self.selector)[0].attrs[self.attr]
IndexError: list index out of range
What's the best practice to deal with that situation?