Mercurial > hg > cc > cirrus_work
comparison bin/test_warc.py @ 63:9837840f3328
more tests
author | Henry S. Thompson <ht@inf.ed.ac.uk> |
---|---|
date | Fri, 14 Jul 2023 17:39:14 +0100 |
parents | e20c64917805 |
children | b88fdbe8bfa7 |
comparison
equal
deleted
inserted
replaced
62:11cbaee8bbc8 | 63:9837840f3328 |
---|---|
2 | 2 |
3 OUT=open(sys.stdout.fileno(),'wb') | 3 OUT=open(sys.stdout.fileno(),'wb') |
4 | 4 |
5 if (debug:=(sys.argv[1]=='-d')): | 5 if (debug:=(sys.argv[1]=='-d')): |
6 sys.argv.pop(1) | 6 sys.argv.pop(1) |
7 | |
8 tt=int(sys.argv.pop(1)) | |
7 | 9 |
8 def showme(wtype,buf,part): | 10 def showme(wtype,buf,part): |
9 # This should exactly reproduce a complete warc file if called | 11 # This should exactly reproduce a complete warc file if called |
10 # as per version 1 below | 12 # as per version 1 below |
11 if debug: | 13 if debug: |
17 OUT.write(b'\r\n') # to match complete file formatting | 19 OUT.write(b'\r\n') # to match complete file formatting |
18 if debug: | 20 if debug: |
19 OUT.write(b"----end %d-----\n"%part) | 21 OUT.write(b"----end %d-----\n"%part) |
20 return OUT | 22 return OUT |
21 | 23 |
22 # 1 | 24 if tt==1: |
23 warc.warc(sys.argv[1],showme,[b'response','warcinfo','request','metadata'],parts=int(sys.argv[2]),debug=debug) | 25 warc.warc(sys.argv[1],showme,[b'response','warcinfo','request','metadata'],parts=int(sys.argv[2]),debug=debug) |
24 | 26 elif tt==2: |
25 # 2 | 27 warc.warc(sys.argv[1],showme,[b'warcinfo'],parts=int(sys.argv[2]),debug=debug) |
26 #warc.warc(sys.argv[1],showme,[b'warcinfo'],parts=int(sys.argv[2]),debug=debug) | 28 elif tt==3: |
29 warc.warc(sys.argv[1],showme,[b'warcinfo'],whole=True,debug=debug) | |
30 elif tt==4: | |
31 warc.warc(sys.argv[1],showme,[b'response','warcinfo','request','metadata'],whole=True,debug=debug) |