From 832ea26e23155b6c0600e28a8b0be9906dc70543 Mon Sep 17 00:00:00 2001 From: Sammy Sidhu Date: Mon, 31 Jul 2023 15:53:01 -0700 Subject: [PATCH] [BUG] Set SSL paths on linux (#1203) * Inject ssl cert env variables for linux machines --- daft/io/__init__.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/daft/io/__init__.py b/daft/io/__init__.py index 22ac81e161..e39133b682 100644 --- a/daft/io/__init__.py +++ b/daft/io/__init__.py @@ -1,9 +1,26 @@ from __future__ import annotations +import sys + from daft.io._csv import read_csv from daft.io._json import read_json from daft.io.config import IOConfig, S3Config from daft.io.file_path import from_glob_path from daft.io.parquet import read_parquet + +def _set_linux_cert_paths(): + import os + import ssl + + paths = ssl.get_default_verify_paths() + if paths.cafile: + os.environ[paths.openssl_cafile_env] = paths.openssl_cafile + if paths.capath: + os.environ[paths.openssl_capath_env] = paths.openssl_capath + + +if sys.platform == "linux": + _set_linux_cert_paths() + __all__ = ["read_csv", "read_json", "from_glob_path", "read_parquet", "IOConfig", "S3Config"]