All pastes #1966100 Raw Edit

sdfsdfd

public python v1 · immutable
#1966100 ·published 2010-10-18 19:26 UTC
rendered paste body
from cStringIO import StringIOfrom gzip import GzipFiledef main(argv):    SEP_SEQ = '\r\n\r\n'    winders = bool(argv[2]) if len(argv) > 2 else False    with open(argv[1], 'rb') as inf:        inbuf = inf.read()        if winders:            inbuf = inbuf.replace('\r\n', '\n')        sindex = inbuf.find(SEP_SEQ) + len(SEP_SEQ)        eindex = inbuf.rfind('\nCLOSED')        entity = inbuf[sindex:eindex]        entitystream = StringIO(entity)        entitygz = GzipFile(fileobj=entitystream, mode='rb')        print entitygz.read()    return 0if __name__ == '__main__':    sys.exit(main(sys.argv))