ecmwf / cdsapi

Python API to access the Copernicus Climate Data Store (CDS)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

'Overload' object has no attribute 'timeout'

AntonJot opened this issue · comments

I have been using the cdsapi for a long time now, but since today, I get the error message.

2022-02-24 16:02:11,614 INFO Sending request to https://cds.climate.copernicus.eu/api/v2/resources/reanalysis-era5-single-levels
2022-02-24 16:02:11,646 INFO Request is queued
2022-02-24 16:02:12,675 INFO Request is failed
2022-02-24 16:02:12,675 ERROR Message: an internal error occurred processing your request
2022-02-24 16:02:12,690 ERROR Reason:  'Overload' object has no attribute 'timeout'
2022-02-24 16:02:12,690 ERROR   Traceback (most recent call last):
2022-02-24 16:02:12,690 ERROR     File "/opt/cdstoolbox/cdscompute/cdscompute/cdshandlers/services/handler.py", line 51, in handle_request
2022-02-24 16:02:12,690 ERROR       timeout = proc.timeout
2022-02-24 16:02:12,690 ERROR   AttributeError: 'Overload' object has no attribute 'timeout'

I am using cdsapi as follows (with many consecutive / parallel calls):

API_URL = "https://cds.climate.copernicus.eu/api/v2"

c = cdsapi.Client(key=api_key, url=API_URL)`
dataset_name = 'reanalysis-era5-single-levels'
download_date = datetime.datetime(1979,1,7,7,0)
cds_params =  {'product_type': 'reanalysis', 'format': 'netcdf', 'variable': 'total_precipitation', 'year': '1979', 'month': '01', 'day': '07', 'time': ['07:00']}
download_path = "{some-path-on-disc}.nc"
try:
    c.retrieve(dataset_name, cds_params, download_path)
    return True

except Exception as err:
    if any(
        [
            str(err).startswith("no data"),
            "the request you have submitted is not valid. There is no data matching your request." in str(err),
        ]
    ):
        logger.info(f"No data found for {download_date}")
        return False
    else:
        raise err

Is this a bug in the api or or am I doing something wrong?

Hi @AntonJot ,
I cannot reproduce this error. From the traceback it looks like a temporary issue with the data on the CDS as opposed to an issue with your cdsapi setup. For these issues I recommend the C3S user channels which will provide a prompter response and forums and notices where you can find any known issues currently affecting datasets.
https://cds.climate.copernicus.eu/cdsapp#!/usersupport

Many thanks,
Eddy