cdsapi icon indicating copy to clipboard operation
cdsapi copied to clipboard

missing methods on `cads_api_client.processing.Results` object when downloading from cds-beta

Open WeatherGod opened this issue 1 year ago • 11 comments

What happened?

I have existing code that I'm trying out on cds-beta. The code was based on the example given at https://github.com/ecmwf/cdsapi/blob/master/examples/example-era5-update.py in this repository to do non-blocking downloads of requests. This works fine when pointed to the legacy cds URL, however, it fails if pointed to a cds-beta URL because the method update() doesn't exist, and even if it did exist, the next line would fail because the result object doesn't have a reply attribute.

Old URL:

(Pdb) type(r)
<class 'cdsapi.api.Result'>
(Pdb) dir(r)
['__class__', '__del__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__',
'__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', 
'__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 
'_deleted', '_download', '_url', 'check', 'cleanup', 'content_length', 'content_type', 'debug', 'delete', 'download', 'error', 'info', 
'location', 'progress', 'reply', 'retry_max', 'robust', 'session', 'sleep_max', 'timeout', 'toJSON', 'update', 'verify', 'warning']

New URL:

(Pdb) type(r)
<class 'cads_api_client.processing.Results'>
(Pdb) dir(r)
['__annotations__', '__attrs_attrs__', '__attrs_own_setattr__', '__class__', '__delattr__', '__dict__', '__dir__', '__doc__', 
'__eq__', '__format__', '__ge__', '__getattribute__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', 
'__le__', '__lt__', '__match_args__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', 
'__setattr__', '__setstate__', '__sizeof__', '__slots__', '__str__', '__subclasshook__', '__weakref__', 'download', 
'from_rel_href', 'from_request', 'get_link_href', 'get_links', 'get_result_href', 'get_result_size', 'headers', 'json', 'location', 
'log_messages', 'reason', 'response', 'session', 'status_code']

What are the steps to reproduce the bug?

Run the code in the examples directory against a cds-beta url.

Version

v0.7.0

Platform (OS and architecture)

linux

Relevant log output

No response

Accompanying data

No response

Organisation

No response

WeatherGod avatar Aug 01 '24 18:08 WeatherGod