diff --git a/dfm_tools/download.py b/dfm_tools/download.py index e50b9d32f..7984e5c11 100644 --- a/dfm_tools/download.py +++ b/dfm_tools/download.py @@ -151,12 +151,13 @@ def cds_credentials(): if os.path.exists(file_credentials): print('found CDS apikey') else: - print("Downloading CDS/ERA5 data requires a CDS apikey, copy the user ID (UID) and API key from https://cds.climate.copernicus.eu/api-how-to (first register and sign in) ") - UID = getpass.getpass("\nEnter your UID: ") - apikey = getpass.getpass("Enter your CDS apikey: ") + print("Downloading CDS/ERA5 data requires a CDS API key, copy the key from https://cds.climate.copernicus.eu/api-how-to (first register and sign in) ") + apikey = getpass.getpass("\nEnter your CDS API Key: ") + if ":" not in apikey: + raise ValueError('A ":"-symbol is missing in the provided key (format should be {UID}:{apikey}). Please check the instructions above again.') with open(file_credentials,'w') as fc: fc.write('url: https://cds.climate.copernicus.eu/api/v2\n') - fc.write(f'key: {UID}:{apikey}') + fc.write(f'key: {apikey}') def copernicusmarine_credentials():