Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Commit c263e15

Browse files
authored
Expose legacy properties (#90)
* expose legacy properties * typo * improve README
1 parent 8383d88 commit c263e15

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,15 @@
22

33
CADS API Python client
44

5+
Documentation: https://ecmwf-projects.github.io/cads-api-client/
6+
57
The `ApiClient` requires the `url` to the API root and a valid API `key`. You can also set the `CADS_API_URL` and `CADS_API_KEY` environment variables, or use a configuration file. The configuration file must be located at `~/.cads-api-client.json`, or at the path specified by the `CADS_API_RC` environment variable.
68

9+
```
10+
$ cat $HOME/.cads-api-client.json
11+
{"url": "https://cds.climate.copernicus.eu/api", "key": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"}
12+
```
13+
714
It is possible (though not recommended) to use the API key of one of the test users, `00112233-4455-6677-c899-aabbccddeeff`. This key is used for anonymous tests and is designed to be the least performant option for accessing the system.
815

916
Draft Python API:

cads_api_client/api_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ def get_accepted_licences(
214214
self,
215215
scope: Literal[None, "all", "dataset", "portal"] = None,
216216
) -> list[dict[str, Any]]:
217-
"""Retrieve acccepted licences.
217+
"""Retrieve accepted licences.
218218
219219
Parameters
220220
----------

cads_api_client/processing.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -648,18 +648,35 @@ def download(
648648
self._check_size(target)
649649
return target
650650

651-
# cdsapi backward compatibility methods
652651
@property
653652
def location(self) -> str:
653+
"""File location.
654+
655+
Returns
656+
-------
657+
str
658+
"""
654659
result_href = self.asset["href"]
655660
return urllib.parse.urljoin(self.response.url, result_href)
656661

657662
@property
658663
def content_length(self) -> int:
664+
"""File size in Bytes.
665+
666+
Returns
667+
-------
668+
int
669+
"""
659670
return int(self.asset["file:size"])
660671

661672
@property
662673
def content_type(self) -> str:
674+
"""File MIME type.
675+
676+
Returns
677+
-------
678+
int
679+
"""
663680
return str(self.asset["type"])
664681

665682

0 commit comments

Comments
 (0)