<s> '''<STR_LIT>''' <EOL> from crawler . core . base import * <EOL> import time <EOL> import logging <EOL> logger = logging . getLogger ( __name__ ) <EOL> logger . addHandler ( logging . StreamHandler ( ) ) <EOL> logger . setLevel ( logging . DEBUG ) <EOL> def dp_specs ( spec_url , proxies = None ) : <EOL> soup = get_soup ( spec_url , proxies ) <EOL> specs_div = soup . find ( '<STR_LIT>' , { "<STR_LIT:class>" : "<STR_LIT>" } ) <EOL> if specs_div is None : <EOL> return None <EOL> hds_items = specs_div . findAll ( '<STR_LIT>' ) <EOL> specs_items = specs_div . findAll ( '<STR_LIT>' ) <EOL> techs = [ ] <EOL> for i , item in enumerate ( hds_items ) : <EOL> inner_item = specs_items [ i ] <EOL> key = "<STR_LIT>" <EOL> if item . find ( '<STR_LIT>' ) : <EOL> key = item . find ( '<STR_LIT>' ) . getText ( ) <EOL> else : <EOL> continue <EOL> tech_items = [ ] <EOL> for spec in inner_item . findAll ( '<STR_LIT>' ) : <EOL> if spec . find ( '<STR_LIT>' ) : <EOL> title = spec . find ( '<STR_LIT>' , { "<STR_LIT:class>" : "<STR_LIT:label>" } ) . getText ( ) <EOL> value = unicode ( spec . find ( '<STR_LIT>' , { "<STR_LIT:class>" : "<STR_LIT:value>" } ) ) . encode ( '<STR_LIT:ascii>' , '<STR_LIT:ignore>' ) <EOL> tech = ( title , value ) <EOL> tech_items . append ( tech ) <EOL> techs . append ( ( key , tech_items ) ) <EOL> return techs </s>
