improved SpiderMiddleware's docstrings

--HG--
extra : convert_revision : svn%3Ab85faa78-f9eb-468e-a121-7cced6da292c%40192
This commit is contained in:
Pablo Hoffman 2008-09-01 04:18:12 +00:00
parent c9cafd5c43
commit 037e6c2125
5 changed files with 21 additions and 8 deletions

View File

@ -1,12 +1,14 @@
"""
Limits the scheduler request queue from the point of view of the spider.
That is, if the scheduler queue contains an equal or greater ammount of
requests than the specified limit, the further requests generated by the
spider will be ignored.
RequestLimitMiddleware: Limits the scheduler request queue from the point of
view of the spider. That is, if the scheduler queue contains an equal or
greater ammount of requests than the specified limit, the new requests
(generated by the spider) will be ignored.
The limit is setted from the spider attribute "requests_queue_size". If not
found, from the scrapy setting "REQUESTS_QUEUE_SIZE". If not found, no limit
will be applied. If given a value of 0, no limit will be applied.
"""
from scrapy.core.engine import scrapyengine
from scrapy.conf import settings
from scrapy.http import Request

View File

@ -1,3 +1,8 @@
"""
OffsiteMiddleware: Filters out Requests for URLs outside the domains covered by
the spider.
"""
from scrapy.core import log
from scrapy.http import Request
from scrapy.utils.url import url_is_from_spider

View File

@ -1,7 +1,11 @@
"""
RefererMiddleware: populates Request referer field, based on the Response which
originated it.
"""
from scrapy.core import log
from scrapy.http import Request
class CrawlMiddleware(object):
def process_result(self, response, result, spider):
def _set_referer(r):

View File

@ -1,5 +1,5 @@
"""
Scrapemiddlware to restrict crawling to only some particular URLs
RestrictMiddleware: restricts crawling to fixed set of particular URLs
"""
from scrapy.http import Request

View File

@ -1,11 +1,13 @@
"""
UrlLengthMiddleware: Filters out requests with URLs longer than URLLENGTH_LIMIT
"""
from scrapy.core import log
from scrapy.http import Request
from scrapy.core.exceptions import NotConfigured
from scrapy.conf import settings
class UrlLengthMiddleware(object):
"""This middleware discard requests with URLs longer than URLLENGTH_LIMIT"""
def __init__(self):
self.maxlength = settings.getint('URLLENGTH_LIMIT')
if not self.maxlength: