I noticed in previous Scrapy documentations (http://doc.scrapy.org/en/
0.12/topics/items.html), you could specify a default value per Item
Field().
stock = Field(default=0)
...
product['stock'] # getting field with default value
This doesn't appear to work in later versions, and has been removed
from the documentation.
This will now only set the Item.fields attribute and cause an
exception on product['stock'] access.
What is the correct way do set a default Item Field() value now?
Thanks in advance.
Regards,
Adam M
I'm guessing I could override __init__() on my subclassed Item, and
then call self.setdefault() within the constructor to achieve the same
thing (Item's superclass is dict).
Whilst I'm new to Python- I do have experience in other languages.
Scrapy and Twisted are relatively new to me and so hearing any
recommendations are highly appreciated.
Regards,
Adam