Scrapy download middleware priority (God horse riding smaller the value the higher the priority)

Since before to see the article about Scrapy download middleware article has been that the priority value set in the middleware download is smaller, the priority should pay attention to the recent anti-climb enhanced Web site, you need to use a proxy ip, but because using a free agent so often fail, need to be deleted and the failure of the agency to set a new proxy reissue the request, but I wrote how middleware will not be executed, thus heaven pit, nonsense to say so more direct look at priorities in the end is kind of how;

1, we first write two download middleware, as shown below

2, two intermediate priority, as shown below

3, the results as shown below

to sum up

  We can see A_MiddleWarethe 300 priority value, B_MiddleWarethe priority value 400, when the third step shown in FIG., In fact, the priority order is in the call request, the priority value smaller priority higher (closer to engine), in response, the priority value large priority higher (closer to the downloader), when an exception occurs, the higher the priority is closer to the downloader, it must be determined when the well is provided intermediate priority order of chains.

Guess you like

Origin www.cnblogs.com/FuckSpider/p/11647041.html