Mercurial > hg > cc > cirrus_work
view bin/test_warc.py @ 56:f8c8f79b2532
rework completely to refill as much as possible only when necessary,
basic loop working again, but not refill
| author | Henry S. Thompson <ht@inf.ed.ac.uk> |
|---|---|
| date | Mon, 10 Jul 2023 19:52:18 +0100 |
| parents | e20c64917805 |
| children | 9837840f3328 |
line wrap: on
line source
import warc,sys OUT=open(sys.stdout.fileno(),'wb') if (debug:=(sys.argv[1]=='-d')): sys.argv.pop(1) def showme(wtype,buf,part): # This should exactly reproduce a complete warc file if called # as per version 1 below if debug: OUT.write(b"----start %d-----\n"%part) OUT.write(buf) if buf[-1]!=10: OUT.write(b'\r\n') if part==7: OUT.write(b'\r\n') # to match complete file formatting if debug: OUT.write(b"----end %d-----\n"%part) return OUT # 1 warc.warc(sys.argv[1],showme,[b'response','warcinfo','request','metadata'],parts=int(sys.argv[2]),debug=debug) # 2 #warc.warc(sys.argv[1],showme,[b'warcinfo'],parts=int(sys.argv[2]),debug=debug)
