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

fix py3.8 breaking changes #73

Merged
merged 1 commit into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions cads_api_client/catalogue.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,15 @@ def temporal_interval(self) -> tuple[str, str]:

@property
def begin_datetime(self) -> datetime.datetime:
return datetime.datetime.fromisoformat(self.temporal_interval[0])
return datetime.datetime.fromisoformat(
self.temporal_interval[0].replace("Z", "+00:00")
)

@property
def end_datetime(self) -> datetime.datetime:
return datetime.datetime.fromisoformat(self.temporal_interval[1])
return datetime.datetime.fromisoformat(
self.temporal_interval[1].replace("Z", "+00:00")
)

@property
def id(self) -> str:
Expand Down
3 changes: 2 additions & 1 deletion cads_api_client/processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,8 @@ def download(
parts = urllib.parse.urlparse(url)
target = parts.path.strip("/").split("/")[-1]

download_options = {"stream": True} | self.download_options
download_options = {"stream": True}
download_options.update(self.download_options)
multiurl.download(
url,
target=target,
Expand Down
10 changes: 2 additions & 8 deletions tests/integration_test_40_api_client.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from __future__ import annotations

import contextlib
import datetime
import os
import pathlib
import warnings
from typing import Any

import pytest
Expand Down Expand Up @@ -79,13 +80,6 @@ def test_api_client_verify(
api_anon_key: str,
tmp_path: pathlib.Path,
) -> None:
secure_client = ApiClient(
url=api_root_url, key=api_anon_key, verify=True, maximum_tries=0
)
with warnings.catch_warnings(category=InsecureRequestWarning):
warnings.simplefilter("error")
secure_client.retrieve("test-adaptor-dummy", target=str(tmp_path / "test.grib"))

insecure_client = ApiClient(
url=api_root_url, key=api_anon_key, verify=False, maximum_tries=0
)
Expand Down
2 changes: 2 additions & 0 deletions tests/integration_test_50_legacy_api_client.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import contextlib
import pathlib
import time
Expand Down