Skip to content

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

removed some old code from scrapy.spider.models

Pablo Hoffmanfe88aad27d97
diff --git a/scrapy/spider/models.py b/scrapy/spider/models.py
index 9210464a3..a9b64995e 100644
--- a/scrapy/spider/models.py
+++ b/scrapy/spider/models.py
@@ -14,32 +14,14 @@ from scrapy.utils.trackref import object_ref
def _valid_domain_name(obj):
"""Check the domain name specified is valid"""
if not obj.domain_name:
- raise ValueError("A site domain name is required")
-
-def _valid_download_delay(obj):
- """Check the download delay is valid, if specified"""
- delay = getattr(obj, 'download_delay', 0)
- if not type(delay) in (int, long, float):
- raise ValueError("download_delay must be numeric")
- if float(delay) < 0.0:
- raise ValueError("download_delay must be positive")
+ raise ValueError("Spider 'domain_name' attribute is required")
class ISpider(Interface, IPlugin) :
"""Interface to be implemented by site-specific web spiders"""
- domain_name = Attribute(
- """The domain name of the site to be scraped.""")
-
- download_delay = Attribute(
- """Optional delay in seconds to wait between web page downloads.
- Note that this delay does not apply to image downloads.
- A delay of less than a second can be specified.""")
-
- user_agent = Attribute(
- """Optional User-Agent to use for this domain""")
+ domain_name = Attribute("The domain name of the site to be scraped.")
invariant(_valid_domain_name)
- invariant(_valid_download_delay)
class BaseSpider(object_ref):
"""Base class for scrapy spiders. All spiders must inherit from this