Skip to content

Use system trust store by default #328

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 19, 2025
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
2 changes: 1 addition & 1 deletion nc_py_api/_version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Version of nc_py_api."""

__version__ = "0.18.1"
__version__ = "0.18.2"
13 changes: 12 additions & 1 deletion nc_py_api/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,22 @@
SSL certificates (a.k.a CA bundle) used to verify the identity of requested hosts. Either **True** (default CA bundle),
a path to an SSL certificate file, or **False** (which will disable verification)."""
str_val = environ.get("NPA_NC_CERT", "True")
NPA_NC_CERT = True
# https://github.com/encode/httpx/issues/302
# when "httpx" will switch to use "truststore" by default - uncomment next line
# NPA_NC_CERT = True
if str_val.lower() in ("false", "0"):
NPA_NC_CERT = False
elif str_val.lower() not in ("true", "1"):
NPA_NC_CERT = str_val
else:
# Temporary workaround, see comment above.
# Use system certificate stores

import ssl

import truststore

NPA_NC_CERT = truststore.SSLContext(ssl.PROTOCOL_TLS_CLIENT)

CHUNKED_UPLOAD_V2 = environ.get("CHUNKED_UPLOAD_V2", True)
"""Option to enable/disable **version 2** chunked upload(better Object Storages support).
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ dependencies = [
"httpx>=0.25.2",
"pydantic>=2.1.1",
"python-dotenv>=1",
"truststore==0.10",
"xmltodict>=0.13",
]
optional-dependencies.app = [
Expand Down
Loading