Ejemplo n.º 1
0
class MixedParser(ArchiveParser):
    def __init__(self):
        self.arc = ArcParser()
        self.warc = WarcParser()

    def parse(self, stream, offset=None):
        line = stream.readline()
        while line:
            if line.startswith('WARC'):
                return self.warc.parse(stream, offset, line=line)
            elif line not in ('\n','\r\n','\r'):
                return self.arc.parse(stream, offset, line=line)

            line = stream.readline()
        return None, (), offset
Ejemplo n.º 2
0
class MixedParser(ArchiveParser):
    def __init__(self):
        self.arc = ArcParser()
        self.warc = WarcParser()

    def parse(self, stream, offset=None):
        line = stream.readline()
        while line:
            if line.startswith('WARC'):
                return self.warc.parse(stream, offset, line=line)
            elif line not in ('\n', '\r\n', '\r'):
                return self.arc.parse(stream, offset, line=line)

            line = stream.readline()
        return None, (), offset
Ejemplo n.º 3
0
 def __init__(self):
     self.arc = ArcParser()
     self.warc = WarcParser()
Ejemplo n.º 4
0
 def __init__(self):
     self.arc = ArcParser()
     self.warc = WarcParser()