コード例 #1
0
    def __init__(self, paths, cdx_source):
        self.paths = paths

        self.resolvers = self.make_resolvers(self.paths)

        self.resolve_loader = ResolvingLoader(self.resolvers,
                                              no_record_parse=True)

        self.headers_parser = StatusAndHeadersParser([], verify=False)

        self.cdx_source = cdx_source
コード例 #2
0
ファイル: test_loading.py プロジェクト: mirrorweb/pywb
def load_from_cdx_test(cdx,
                       revisit_func=load_orig_cdx,
                       reraise=False,
                       failed_files=None):
    resolve_loader = ResolvingLoader(
        DefaultResolverMixin.make_resolvers(test_warc_dir))
    cdx = CDXObject(cdx.encode('utf-8'))

    try:
        (headers, stream) = resolve_loader(cdx, failed_files, revisit_func)
        print(repr_format(headers))
        sys.stdout.write(stream.readline().decode('utf-8'))
        sys.stdout.write(stream.readline().decode('utf-8'))
    except ArchiveLoadFailed as e:
        if reraise:
            raise
        else:
            print('Exception: ' + e.__class__.__name__)