<s> """<STR_LIT>""" <EOL> import urlparse <EOL> from spyder . core . constants import CURI_EXTRACTED_URLS <EOL> class HttpExtractor ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , settings ) : <EOL> """<STR_LIT>""" <EOL> self . _not_found_redirects = settings . HTTP_EXTRACTOR_404_REDIRECT <EOL> def __call__ ( self , curi ) : <EOL> """<STR_LIT>""" <EOL> if <NUM_LIT> <= curi . status_code < <NUM_LIT> and curi . rep_header and "<STR_LIT>" in curi . rep_header : <EOL> link = curi . rep_header [ "<STR_LIT>" ] <EOL> if link . find ( "<STR_LIT>" ) == - <NUM_LIT:1> : <EOL> link = urlparse . urljoin ( curi . url , link ) <EOL> if link not in self . _not_found_redirects : <EOL> if not hasattr ( curi , "<STR_LIT>" ) : <EOL> curi . optional_vars = dict ( ) <EOL> if not CURI_EXTRACTED_URLS in curi . optional_vars : <EOL> curi . optional_vars [ CURI_EXTRACTED_URLS ] = link <EOL> else : <EOL> curi . optional_vars [ CURI_EXTRACTED_URLS ] += "<STR_LIT:\n>" + link <EOL> return curi </s>
