Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Downloader Middleware #2446

Closed
wangfengchao opened this issue Dec 13, 2016 · 1 comment
Closed

Downloader Middleware #2446

wangfengchao opened this issue Dec 13, 2016 · 1 comment

Comments

@wangfengchao
Copy link

Hi:
我在使用scrapy1.2.2版本时,没有找到这个scrapy.downloadermiddlewares.DownloaderMiddleware是怎么回事?

@starrify
Copy link
Contributor

I'm sorry but there is no such scrapy.downloadermiddlewares.DownloaderMiddleware.
May I ask where and why you'd need scrapy.downloadermiddlewares.DownloaderMiddleware?

To access a specific downloader middleware, please check https://github.com/scrapy/scrapy/tree/master/scrapy/downloadermiddlewares for the available ones, e.g.

>>> import scrapy.downloadermiddlewares.cookies
>>> scrapy.downloadermiddlewares.cookies.CookiesMiddleware
<class 'scrapy.downloadermiddlewares.cookies.CookiesMiddleware'>

Or if you want to write your own downloader middleware, just subclass from object. See also: https://doc.scrapy.org/en/latest/topics/downloader-middleware.html

Could you please try asking in English in the future? Cuz currently we're not supporting other languages on this issue tracker.

Chinese Version

你好, 目前并不存在这个 scrapy.downloadermiddlewares.DownloaderMiddleware
请问你是在什么地方需要用到它呢?

如果你需要使用现有的下载器中间件(downloader middleware), 请访问 https://github.com/scrapy/scrapy/tree/master/scrapy/downloadermiddlewares 来获取内置的下载器中间件列表并直接使用它们的路径, 例如:

>>> import scrapy.downloadermiddlewares.cookies
>>> scrapy.downloadermiddlewares.cookies.CookiesMiddleware
<class 'scrapy.downloadermiddlewares.cookies.CookiesMiddleware'>

或者如果你希望编写你自己的下载器中间件, 请注意目前它们不需要有指定的公共父类, 请直接从 object 继承就可以了. 参见 https://doc.scrapy.org/en/latest/topics/downloader-middleware.html (中文版本文档: http://scrapy-chs.readthedocs.io/zh_CN/latest/topics/downloader-middleware.html)

另外, 我们目前并不在GitHub提供其他语言的帮助. 请尽量使用英语交流.

@kmike kmike closed this as completed Feb 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants