def _load_different_url_payload(self, cdx, headers_record,
                                    failed_files, cdx_loader):
        """
        Handle the case where a duplicate of a capture with same digest
        exists at a different url.

        If a cdx_server is provided, a query is made for matching
        url, timestamp and digest.

        Raise exception if no matches found.
        """

        ref_target_uri = (headers_record.rec_headers.
                          get_header('WARC-Refers-To-Target-URI'))

        target_uri = headers_record.rec_headers.get_header('WARC-Target-URI')

        # if no target uri, no way to find the original
        if not ref_target_uri:
            raise ArchiveLoadFailed(self.MISSING_REVISIT_MSG)

        ref_target_date = (headers_record.rec_headers.
                           get_header('WARC-Refers-To-Date'))

        if not ref_target_date:
            ref_target_date = cdx['timestamp']
        else:
            ref_target_date = iso_date_to_timestamp(ref_target_date)

        digest = cdx.get('digest', '-')

        try:
            orig_cdx_lines = self.load_cdx_for_dupe(ref_target_uri,
                                                    ref_target_date,
                                                    digest,
                                                    cdx_loader)
        except NotFoundException:
            raise ArchiveLoadFailed(self.MISSING_REVISIT_MSG)

        for orig_cdx in orig_cdx_lines:
            try:
                payload_record = self._resolve_path_load(orig_cdx, False,
                                                         failed_files)
                return payload_record

            except ArchiveLoadFailed as e:
                pass

        raise ArchiveLoadFailed(self.MISSING_REVISIT_MSG)
def _load_different_url_payload ( self , cdx , headers_record , failed_files , cdx_loader ) : ref_target_uri = ( headers_record . rec_headers . get_header ( 'WARC-Refers-To-Target-URI' ) ) target_uri = headers_record . rec_headers . get_header ( 'WARC-Target-URI' ) if not ref_target_uri : raise ArchiveLoadFailed ( self . MISSING_REVISIT_MSG ) ref_target_date = ( headers_record . rec_headers . get_header ( 'WARC-Refers-To-Date' ) ) if not ref_target_date : ref_target_date = cdx [ 'timestamp' ] else : ref_target_date = iso_date_to_timestamp ( ref_target_date ) digest = cdx . get ( 'digest' , '-' ) try : orig_cdx_lines = self . load_cdx_for_dupe ( ref_target_uri , ref_target_date , digest , cdx_loader ) except NotFoundException : raise ArchiveLoadFailed ( self . MISSING_REVISIT_MSG ) for orig_cdx in orig_cdx_lines : try : payload_record = self . _resolve_path_load ( orig_cdx , False , failed_files ) return payload_record except ArchiveLoadFailed as e : pass raise ArchiveLoadFailed ( self . MISSING_REVISIT_MSG )
Handle the case where a duplicate of a capture with same digest
        exists at a different url.

        If a cdx_server is provided, a query is made for matching
        url, timestamp and digest.

        Raise exception if no matches found.