Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

engine: added domain_is_open() method, added docstring for domain_is_closed() method

Pablo Hoffmanc22d2b158798
diff --git a/scrapy/core/engine.py b/scrapy/core/engine.py
index 3ede2123d..bc8cbe6e3 100644
--- a/scrapy/core/engine.py
+++ b/scrapy/core/engine.py
@@ -190,8 +190,15 @@ class ExecutionEngine(object):
return not (pending or downloading or haspipe or scraping)
def domain_is_closed(self, domain):
+ """Return True if the domain is fully closed (ie. not even in the
+ closing stage)"""
return domain not in self.downloader.sites
+ def domain_is_open(self, domain):
+ """Return True if the domain is fully opened (ie. not in closing
+ stage)"""
+ return domain in self.downloader.sites and domain not in self.closing
+
@property
def open_domains(self):
return self.downloader.sites.keys()