(self, server, spider, key, serializer=None)
Initialize per-spider redis queue.

        Parameters
        ----------
        server : StrictRedis
            Redis client instance.
        spider : Spider
            Scrapy spider instance.
        key: str
            Redis key where to put and get messages.
        serializer : object
            Serializer object with ``loads`` and ``dumps`` methods.
Initialize per-spider redis queue.
Initialize per - spider redis queue .
def __init__(self, server, spider, key, serializer=None):
        """Initialize per-spider redis queue.

        Parameters
        ----------
        server : StrictRedis
            Redis client instance.
        spider : Spider
            Scrapy spider instance.
        key: str
            Redis key where to put and get messages.
        serializer : object
            Serializer object with ``loads`` and ``dumps`` methods.

        """
        if serializer is None:
            # Backward compatibility.
            # TODO: deprecate pickle.
            serializer = picklecompat
        if not hasattr(serializer, 'loads'):
            raise TypeError("serializer does not implement 'loads' function: %r"
                            % serializer)
        if not hasattr(serializer, 'dumps'):
            raise TypeError("serializer '%s' does not implement 'dumps' function: %r"
                            % serializer)

        self.server = server
        self.spider = spider
        self.key = key % {'spider': spider.name}
        self.serializer = serializer
def __init__ ( self , server , spider , key , serializer = None ) : if serializer is None : # Backward compatibility. # TODO: deprecate pickle. serializer = picklecompat if not hasattr ( serializer , 'loads' ) : raise TypeError ( "serializer does not implement 'loads' function: %r" % serializer ) if not hasattr ( serializer , 'dumps' ) : raise TypeError ( "serializer '%s' does not implement 'dumps' function: %r" % serializer ) self . server = server self . spider = spider self . key = key % { 'spider' : spider . name } self . serializer = serializer