def __init__(self, selector):
        """

        :param Selector selector: The selector to scrape.
        """
        self._values = {}
        # Iterate all defined fields
        for field_name, field in six.iteritems(self.fields):
            # Scrape field values from selector
            cleaner = getattr(self, 'clean_%s' % field_name, None)
            processor = getattr(self, 'process_%s' % field_name, None)
            value = field.scrape(selector, cleaner=cleaner, processor=processor)
            # Finalize value using finalize_* method on scrape, if it exists
            if hasattr(self, 'finalize_%s' % field_name):
                value = getattr(self, 'finalize_%s' % field_name)(value)
            log.debug('Assigning %s: %s' % (field_name, value))
            setattr(self, field_name, value)
def __init__ ( self , selector ) : self . _values = { } for field_name , field in six . iteritems ( self . fields ) : cleaner = getattr ( self , 'clean_%s' % field_name , None ) processor = getattr ( self , 'process_%s' % field_name , None ) value = field . scrape ( selector , cleaner = cleaner , processor = processor ) if hasattr ( self , 'finalize_%s' % field_name ) : value = getattr ( self , 'finalize_%s' % field_name ) ( value ) log . debug ( 'Assigning %s: %s' % ( field_name , value ) ) setattr ( self , field_name , value )
:param Selector selector: The selector to scrape.