Skip to content

Commit c77cce0

Browse files
authored
optional ssl (#24)
1 parent 5c767a8 commit c77cce0

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

xarray_esgf/client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ class Client:
5656
esgpull_path: str | Path | None = None
5757
index_node: str | None = None
5858
retries: int = 0
59+
verify_ssl: bool = False
5960

6061
@cached_property
6162
def _client(self) -> Esgpull:
@@ -64,7 +65,7 @@ def _client(self) -> Esgpull:
6465
install=True,
6566
load_db=False,
6667
)
67-
client.config.download.disable_ssl = True
68+
client.config.download.disable_ssl = not self.verify_ssl
6869
if self.index_node is not None:
6970
client.config.api.index_node = self.index_node
7071
return client
@@ -138,6 +139,7 @@ def open_dataset(
138139
chunks=-1,
139140
engine="h5netcdf",
140141
drop_variables=drop_variables,
142+
storage_options={"verify_ssl": self.verify_ssl},
141143
)
142144
grouped_objects[file.dataset_id].append(ds.drop_encoding())
143145

xarray_esgf/engine.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@ def open_dataset( # type: ignore[override]
2020
download: bool = False,
2121
show_progress: bool = True,
2222
retries: int = 0,
23+
verify_ssl: bool = False,
2324
) -> Dataset:
2425
client = Client(
2526
selection=filename_or_obj,
2627
esgpull_path=esgpull_path,
2728
index_node=index_node,
2829
retries=retries,
30+
verify_ssl=verify_ssl,
2931
)
3032
return client.open_dataset(
3133
concat_dims=concat_dims,

0 commit comments

Comments
 (0)