Unable to define custom downloader middleware in Scrapy

后端 未结 1 994
温柔的废话
温柔的废话 2021-02-06 06:30

I am attempting to set up a custom downloader middleware class in Scrapy. I suspect that I\'ve missed something obvious, but I\'ve read over the docs a few times and have found

1条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-06 07:29

    DOWNLOADER_MIDDLEWARES = { 'myproject.middlewares.TestDownloader': 400 }
    

    For this to work, create file middlewares.py inside myproject folder, and in that file put your downloader middleware class called TestDownloader.

    Or having middlewares folder with __init__.py inside it, you can put put your downloader middleware class called TestDownloader inside __init__.py -- this should work too.

    0 讨论(0)
提交回复
热议问题