Skip to content

Commit 51dbcc9

Browse files
committed
use system trust store by default
Signed-off-by: bigcat88 <[email protected]>
1 parent 78a6f76 commit 51dbcc9

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

nc_py_api/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""Version of nc_py_api."""
22

3-
__version__ = "0.18.1"
3+
__version__ = "0.18.2"

nc_py_api/options.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,21 @@
3333
SSL certificates (a.k.a CA bundle) used to verify the identity of requested hosts. Either **True** (default CA bundle),
3434
a path to an SSL certificate file, or **False** (which will disable verification)."""
3535
str_val = environ.get("NPA_NC_CERT", "True")
36-
NPA_NC_CERT = True
36+
# https://github.com/encode/httpx/issues/302
37+
# when "httpx" will switch to use "truststore" by default - uncomment next line
38+
# NPA_NC_CERT = True
3739
if str_val.lower() in ("false", "0"):
3840
NPA_NC_CERT = False
3941
elif str_val.lower() not in ("true", "1"):
4042
NPA_NC_CERT = str_val
43+
else:
44+
# Temporary workaround, see comment above.
45+
# Use system certificate stores
46+
47+
import ssl
48+
import truststore
49+
50+
NPA_NC_CERT = truststore.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
4151

4252
CHUNKED_UPLOAD_V2 = environ.get("CHUNKED_UPLOAD_V2", True)
4353
"""Option to enable/disable **version 2** chunked upload(better Object Storages support).

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ dependencies = [
5050
"pydantic>=2.1.1",
5151
"python-dotenv>=1",
5252
"xmltodict>=0.13",
53+
"truststore==0.10.0",
5354
]
5455
optional-dependencies.app = [
5556
"uvicorn[standard]>=0.23.2",

0 commit comments

Comments
 (0)