external-systems 0.103.0rc1__py3-none-any.whl → 0.103.0rc3__py3-none-any.whl

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.

@@ -16,4 +16,4 @@
16
16
  # The version is set during the publishing step (since we can't know the version in advance)
17
17
  # using the autorelease bot
18
18
 
19
- __version__ = "0.103.0-rc1"
19
+ __version__ = "0.103.0-rc3"
@@ -81,22 +81,48 @@ class Source:
81
81
 
82
82
  @cached_property
83
83
  def _ca_bundle_path(self) -> Optional[str]:
84
- if self._source_parameters.server_certificates is None:
85
- return None
84
+ """
85
+ Returns the path to the CA bundle file with all custom CA certificates defined in the Source.
86
86
 
87
- # Precedence of which CA bundle to use for the Session object:
88
- # 1. Custom CA bundle path (if provided we assume PEM format)
89
- # 2. Requests CA bundle path
90
- # 3. Temporary file
91
- ca_bundle_path = (
92
- self._custom_ca_bundle_path
93
- or os.environ.get("REQUESTS_CA_BUNDLE")
94
- or NamedTemporaryFile(delete=False, mode="w").name
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
+ # Finally, try reading the provided CA bundle path and appending all content to the new CA bundle
117
+ new_ca_contents = []
118
+ with open(provided_ca_bundle_path) as provided_ca_bundle_file:
119
+ new_ca_contents.append(provided_ca_bundle_file.read())
120
+
121
+ for required_ca in self._source_parameters.server_certificates.values():
122
+ new_ca_contents.append(required_ca)
96
123
 
97
- server_certificates = self._source_parameters.server_certificates.values()
98
- with open(ca_bundle_path, "a") as ca_bundle_file:
99
- ca_bundle_file.write(os.linesep.join(server_certificates) + os.linesep)
124
+ with NamedTemporaryFile(delete=False, mode="w") as ca_bundle_file:
125
+ ca_bundle_file.write(os.linesep.join(new_ca_contents) + os.linesep)
100
126
  return ca_bundle_file.name
101
127
 
102
128
  @cached_property
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: external-systems
3
- Version: 0.103.0rc1
3
+ Version: 0.103.0rc3
4
4
  Summary: A Python library for interacting with Foundry Sources
5
5
  License: Apache-2.0
6
6
  Keywords: Palantir,Foundry,Sources,Compute Modules,Python Functions,Transforms
@@ -1,5 +1,5 @@
1
1
  external_systems/__init__.py,sha256=xXDUDD6_qRO-nHuXZx-fXp0R0vc3N_OOsB1F5mF_kpU,651
2
- external_systems/_version.py,sha256=c_mfS4PZeLJy0ogjiUVZANeBTYyWBz2voOqwBuulZ60,753
2
+ external_systems/_version.py,sha256=Im2RcVcQ05rkZ2xp6nHFHW7mj6_uYHgcbwfBM_plNDY,753
3
3
  external_systems/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  external_systems/sources/__init__.py,sha256=aqXbMIy_pnyIC1uPRzQfApLCbhYB4N8iRFnpOX4RdAk,1156
5
5
  external_systems/sources/_api.py,sha256=NV7oNIgzSWz4ROFW8uPpUJjDN5vfFzdTs3yKC37S39k,3262
@@ -7,9 +7,9 @@ external_systems/sources/_connections.py,sha256=h82npEks29NALAAfMHrXcSnB7TY_OLeX
7
7
  external_systems/sources/_proxies.py,sha256=8Rq197KkGXVkwlK8lJNxrs3b1xul09XGh9E4r9nedgA,5722
8
8
  external_systems/sources/_refreshable.py,sha256=0pa5XW0_2gTMW-ZymKhlhh3Kka_bWTWffThKvrTTifc,4421
9
9
  external_systems/sources/_sockets.py,sha256=XH51adVnloqg8XYVHPxl6K8R_q2BCh6WZ77cq1L8nRg,4473
10
- external_systems/sources/_sources.py,sha256=Zt0I_U5tMJrfTOvT5jEMG5jE10JevrI2V0ZX7FDWDfA,10604
10
+ external_systems/sources/_sources.py,sha256=WmWwXm_jhtDOpGXO8XMuNoYmf2aosdQGwnBVJNWsnTQ,12029
11
11
  external_systems/sources/_utils.py,sha256=_GDyJOzPHQudEbrPsRhXMs8u6AaHpgJQIq8H9xSYJZk,913
12
- external_systems-0.103.0rc1.dist-info/LICENSE.txt,sha256=NAk6Uc9K_N_J5V75k9qECpzUnO-ujT-mKK_jk_mboUE,569
13
- external_systems-0.103.0rc1.dist-info/METADATA,sha256=37nCIIvCCsNeXy_Kk1u7ZCTvqssmU6fo0sXzhTNNCBc,4768
14
- external_systems-0.103.0rc1.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
15
- external_systems-0.103.0rc1.dist-info/RECORD,,
12
+ external_systems-0.103.0rc3.dist-info/LICENSE.txt,sha256=NAk6Uc9K_N_J5V75k9qECpzUnO-ujT-mKK_jk_mboUE,569
13
+ external_systems-0.103.0rc3.dist-info/METADATA,sha256=8SMEtU2lzxB0C04N5nA7i4rLQLb8_qgRF-xIzoNBWHk,4768
14
+ external_systems-0.103.0rc3.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
15
+ external_systems-0.103.0rc3.dist-info/RECORD,,