Posted By


scrapy on 09/01/12

Tagged


Statistics


Viewed 226 times
Favorited by 0 user(s)

Raising CloseSpider


/ Published in: Python
Save to your folder(s)



Copy this code and paste it in your HTML
  1. # Required import statement for CloseSpider. Note: if intending to limit items, you can pass '--SET CLOSESPIDER_ITEMCOUNT=10' like so:
  2. #
  3. # scrapy crawl googledir --set CLOSESPIDER_ITEMCOUNT=10
  4.  
  5. from scrapy.exceptions import CloseSpider
  6.  
  7. raise CloseSpider('reason for closing')
  8.  
  9. # Snippet imported from snippets.scrapy.org (which no longer works)
  10. # author: redtricycle
  11. # date : Nov 21, 2011
  12.  

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.