external-systems 0.103.0rc1__tar.gz → 0.103.0rc2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of external-systems might be problematic. Click here for more details.
- {external_systems-0.103.0rc1 → external_systems-0.103.0rc2}/PKG-INFO +1 -1
- {external_systems-0.103.0rc1 → external_systems-0.103.0rc2}/external_systems/_version.py +1 -1
- {external_systems-0.103.0rc1 → external_systems-0.103.0rc2}/external_systems/sources/_sources.py +46 -14
- {external_systems-0.103.0rc1 → external_systems-0.103.0rc2}/pyproject.toml +1 -1
- {external_systems-0.103.0rc1 → external_systems-0.103.0rc2}/LICENSE.txt +0 -0
- {external_systems-0.103.0rc1 → external_systems-0.103.0rc2}/README.md +0 -0
- {external_systems-0.103.0rc1 → external_systems-0.103.0rc2}/external_systems/__init__.py +0 -0
- {external_systems-0.103.0rc1 → external_systems-0.103.0rc2}/external_systems/py.typed +0 -0
- {external_systems-0.103.0rc1 → external_systems-0.103.0rc2}/external_systems/sources/__init__.py +0 -0
- {external_systems-0.103.0rc1 → external_systems-0.103.0rc2}/external_systems/sources/_api.py +0 -0
- {external_systems-0.103.0rc1 → external_systems-0.103.0rc2}/external_systems/sources/_connections.py +0 -0
- {external_systems-0.103.0rc1 → external_systems-0.103.0rc2}/external_systems/sources/_proxies.py +0 -0
- {external_systems-0.103.0rc1 → external_systems-0.103.0rc2}/external_systems/sources/_refreshable.py +0 -0
- {external_systems-0.103.0rc1 → external_systems-0.103.0rc2}/external_systems/sources/_sockets.py +0 -0
- {external_systems-0.103.0rc1 → external_systems-0.103.0rc2}/external_systems/sources/_utils.py +0 -0
{external_systems-0.103.0rc1 → external_systems-0.103.0rc2}/external_systems/sources/_sources.py
RENAMED
|
@@ -81,22 +81,54 @@ class Source:
|
|
|
81
81
|
|
|
82
82
|
@cached_property
|
|
83
83
|
def _ca_bundle_path(self) -> Optional[str]:
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
"""
|
|
85
|
+
Returns the path to the CA bundle file with all custom CA certificates defined in the Source.
|
|
86
86
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
87
|
+
Precedence of which CA bundle to use:
|
|
88
|
+
1. Custom CA bundle path (if provided assumes PEM format)
|
|
89
|
+
2. Requests CA bundle path
|
|
90
|
+
3. Temporary file
|
|
91
|
+
"""
|
|
92
|
+
|
|
93
|
+
provided_ca_bundle_path = self._custom_ca_bundle_path or os.environ.get("REQUESTS_CA_BUNDLE")
|
|
94
|
+
|
|
95
|
+
if not self._source_parameters.server_certificates:
|
|
96
|
+
return provided_ca_bundle_path
|
|
97
|
+
|
|
98
|
+
# Certificates from the Source to add to the CA bundle
|
|
99
|
+
server_certificates = list(self._source_parameters.server_certificates.values())
|
|
100
|
+
|
|
101
|
+
# If no provided CA bundle path, create a temporary file with only the server certificates
|
|
102
|
+
if not provided_ca_bundle_path:
|
|
103
|
+
with NamedTemporaryFile(delete=False, mode="w") as ca_bundle_file:
|
|
104
|
+
ca_bundle_file.write(os.linesep.join(server_certificates) + os.linesep)
|
|
105
|
+
return ca_bundle_file.name
|
|
106
|
+
|
|
107
|
+
# See https://docs.python.org/3/library/os.html#os.access for why we don't use os.access
|
|
108
|
+
# First try appending the server certificates to the provided CA bundle path
|
|
109
|
+
try:
|
|
110
|
+
with open(provided_ca_bundle_path, "a") as provided_ca_bundle_file:
|
|
111
|
+
provided_ca_bundle_file.write(os.linesep.join(server_certificates) + os.linesep)
|
|
112
|
+
return provided_ca_bundle_path
|
|
113
|
+
except PermissionError:
|
|
114
|
+
log.warning("PermissionError when writing to provided CA bundle path, falling back to temporary file.")
|
|
115
|
+
|
|
116
|
+
# Second try reading the provided CA bundle path and appending all content to the new CA bundle
|
|
117
|
+
new_ca_contents = []
|
|
118
|
+
try:
|
|
119
|
+
with open(provided_ca_bundle_path) as provided_ca_bundle_file:
|
|
120
|
+
new_ca_contents.append(provided_ca_bundle_file.read())
|
|
121
|
+
except PermissionError:
|
|
122
|
+
log.warning(
|
|
123
|
+
"PermissionError when reading from provided CA bundle path, falling back to temporary file with only the Source defined certificates."
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
# Finally, if no permissions to read or write to the provided CA bundle path, create a temporary file with only the Source defined certificates
|
|
127
|
+
for required_ca in self._source_parameters.server_certificates.values():
|
|
128
|
+
new_ca_contents.append(required_ca)
|
|
96
129
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
ca_bundle_file.write(os.linesep.join(server_certificates) + os.linesep)
|
|
130
|
+
with NamedTemporaryFile(delete=False, mode="w") as ca_bundle_file:
|
|
131
|
+
ca_bundle_file.write(os.linesep.join(new_ca_contents) + os.linesep)
|
|
100
132
|
return ca_bundle_file.name
|
|
101
133
|
|
|
102
134
|
@cached_property
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{external_systems-0.103.0rc1 → external_systems-0.103.0rc2}/external_systems/sources/__init__.py
RENAMED
|
File without changes
|
{external_systems-0.103.0rc1 → external_systems-0.103.0rc2}/external_systems/sources/_api.py
RENAMED
|
File without changes
|
{external_systems-0.103.0rc1 → external_systems-0.103.0rc2}/external_systems/sources/_connections.py
RENAMED
|
File without changes
|
{external_systems-0.103.0rc1 → external_systems-0.103.0rc2}/external_systems/sources/_proxies.py
RENAMED
|
File without changes
|
{external_systems-0.103.0rc1 → external_systems-0.103.0rc2}/external_systems/sources/_refreshable.py
RENAMED
|
File without changes
|
{external_systems-0.103.0rc1 → external_systems-0.103.0rc2}/external_systems/sources/_sockets.py
RENAMED
|
File without changes
|
{external_systems-0.103.0rc1 → external_systems-0.103.0rc2}/external_systems/sources/_utils.py
RENAMED
|
File without changes
|