Skip to content

Commit f6e31a7

Browse files
authored
use new url (#189)
* use beta url * use right url
1 parent 4cd1f10 commit f6e31a7

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

scripts/validate-filenames.py

+9-6
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"variability",
4141
)
4242

43-
API_URL = "https://cds.climate.copernicus.eu/api/v2"
43+
API_URL = "https://cds.climate.copernicus.eu/api/catalogue/v1/collections"
4444

4545

4646
def main(paths: list[Path]) -> None:
@@ -50,7 +50,7 @@ def main(paths: list[Path]) -> None:
5050
assert len(segments) == 4, f"{path=!s}: Invalid {path.name=}"
5151
(
5252
data_type,
53-
dataset_id,
53+
collection_id,
5454
assessment_category,
5555
question_number,
5656
) = segments
@@ -64,10 +64,13 @@ def main(paths: list[Path]) -> None:
6464
assert folder in path.parts[folder_index], f"{path=!s}: Invalid {folder=}"
6565

6666
# Check dataset ID
67-
url = f"{API_URL}/resources/dataset/{dataset_id}"
68-
assert (
69-
urllib.request.urlopen(url).getcode() == 200
70-
), f"{path=!s}: Invalid {dataset_id=}"
67+
url = "/".join([API_URL, collection_id])
68+
code = None
69+
try:
70+
code = urllib.request.urlopen(url).getcode()
71+
except Exception:
72+
pass
73+
assert code == 200, f"{path=!s}: Invalid {collection_id=}"
7174

7275
# Check assessment category
7376
assert (

0 commit comments

Comments
 (0)