Writing items to a MySQL database in Scrapy

后端 未结 3 658
囚心锁ツ
囚心锁ツ 2020-12-02 08:48

I am new to Scrapy, I had the spider code

class Example_spider(BaseSpider):
   name = \"example\"
   allowed_domains = [\"www.example.com\"]

   def start_re         


        
3条回答
  •  旧巷少年郎
    2020-12-02 09:17

    Your process_item method should be declared as: def process_item(self, item, spider): instead of def process_item(self, spider, item): -> you switched the arguments around.

    This exception: exceptions.NameError: global name 'Exampleitem' is not defined indicates you didn't import the Exampleitem in your pipeline. Try adding: from myspiders.myitems import Exampleitem (with correct names/paths ofcourse).

提交回复
热议问题