import json,hashlib,urllib.request
base='https://sentinel-sources-beta.ewsx.workers.dev/'
def get(p):return urllib.request.urlopen(urllib.request.Request(base+p,headers={'User-Agent':'Sentinel-Source-Downloader/1.0'})).read()
m=json.loads(get('manifest.json'));h=hashlib.sha256()
with open(m['file'],'wb') as f:
 for p in m['parts']:
  b=get(p['path']);assert hashlib.sha256(b).hexdigest()==p['sha256'];f.write(b);h.update(b)
assert h.hexdigest()==m['sha256']
print('Verified',m['file'])
