Skip to content

Commit

Permalink
Merge pull request #125 from technologiestiftung/staging
Browse files Browse the repository at this point in the history
fix: skip dwd files that do not exist yet
  • Loading branch information
Jaszkowic authored May 28, 2024
2 parents 5dc097d + d42e8d2 commit aa3256f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions harvester/src/download_radolan_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,14 @@ def download_radolan_data(start_date, end_date, path):
file_name = f"RW-{date_str}.tar.gz"
download_url = f"{url}/{file_name}"
dest_file = os.path.join(path, file_name)
urllib.request.urlretrieve(download_url, dest_file)
downloaded_files.append(dest_file)
start_date += timedelta(days=1)
logging.info(f"Downloading {download_url}...")
try:
urllib.request.urlretrieve(download_url, dest_file)
downloaded_files.append(dest_file)
logging.info(f"Downloading {download_url}...")
except Exception as e:
logging.info(f"Skipping download {download_url}: {e}")
finally:
start_date += timedelta(days=1)

return downloaded_files

Expand Down

0 comments on commit aa3256f

Please sign in to comment.