import requests

pages = [
    ('https://www.gutenberg.org/nonexistent-page', 'missing.html'),
    ('https://www.gutenberg.org/files/345/345-h/345-h.htm', 'dracula.html'),
]

for url, filename in pages:
    try:
        response = requests.get(url, timeout=10)
        response.raise_for_status()
    except requests.exceptions.RequestException as error:
        print('Skipping', url, error)
        continue

    response.encoding = 'utf-8'
    with open(filename, 'w', encoding='utf-8') as f:
        f.write(response.text)
    print('Saved', filename)
