HTTPError: 400 Client Error: Bad Request for url: https://cds.climate.copernicus.eu/api/retrieve/v1/jobs/e7166a79-07b5-4ad4-a212-cd1edae53b60/resultsThe job has failedThe job failed with: TypeError

I am following the code from this tutorial.

When I type:

# DOWNLOAD DATA FOR HISTORICAL PERIOD

c = cdsapi.Client(url=URL, key=KEY)

for j in models:
    c.retrieve(
        'projections-cmip6',
        {
            'download_format': 'zip',
            'data_format': 'netcdf_legacy',
            'temporal_resolution': 'monthly',
            'experiment': 'historical',
            'level': 'single_levels',
            'variable': 'near_surface_air_temperature',
            'model': f'{j}',
            'date': '1850-01-01/2014-12-31',
        },
        f'{DATADIR}cmip6_monthly_1850-2014_historical_{j}.zip')

I get the following error:

HTTPError: 400 Client Error: Bad Request for url: https://cds.climate.copernicus.eu/api/retrieve/v1/jobs/e7166a79-07b5-4ad4-a212-cd1edae53b60/results
The job has failed
The job failed with: TypeError

all of the code run prior to this can be seen in the notebook I linked the url for at the top.

Please can someone help?

Thanks!

Hi,
please use the relevant webform on the Climate Data Store (CDS) to build and check the syntax of your API request:

Thanks