view bin/test_warc.py @ 42:689a0e311cd2

make warc.py a library, separate out testing
author Henry S. Thompson <ht@inf.ed.ac.uk>
date Wed, 05 Jul 2023 15:37:16 +0100
parents
children 212da3fe3b19
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):
  if debug:
    breakpoint()
  OUT.write(b"%d\n%b"%(part,buf))


#warc(showme,[b'response','warcinfo','request','metadata'],int(sys.argv[2]))
#warc(showme,[b'response'],whole=True)

warc.warc(sys.argv[1],showme,[b'response'],parts=int(sys.argv[2]),debug=debug)