2 # run from a build_machine
8 shasums = requests.get("https://files.pushshift.io/reddit/comments/sha256sums.txt").text
10 dumpdir = "/gscratch/comdata/raw_data/reddit_dumps/comments"
12 for l in shasums.strip().split('\n'):
13 sha256_hash = hashlib.sha256()
16 correct_sha256 = parts[0]
18 print(f"checking {filename}")
19 fpath = path.join(dumpdir,filename)
20 if path.isfile(fpath):
21 with open(fpath,'rb') as f:
22 for byte_block in iter(lambda: f.read(4096),b""):
23 sha256_hash.update(byte_block)
25 if sha256_hash.hexdigest() == correct_sha256:
26 print(f"{filename} checks out")
28 print(f"ERROR! {filename} has the wrong hash. Redownload and recheck!")
30 print(f"Skipping {filename} as it doesn't exist")