import requests
import pathlib


def dl_at_qual(pct):
    for num in range(9, 51):
        path = pathlib.Path(f'imgs/danube_{pct}_pct/{num}.jpg')
        if path.exists():
            return
        else:
            if num == 9:
                num = '09'
            r = requests.get(f'https://iiif.onb.ac.at/images/REPO/7502199/000000{num}.jpg/full/pct:{pct}/0/native.jpg')
            open(path, 'wb').write(r.content)


if __name__ == '__main__':
    dl_at_qual(10)
