dhruv-pratap commented on code in PR #6019:
URL: https://github.com/apache/iceberg/pull/6019#discussion_r1000910944


##########
python/pyiceberg/catalog/rest.py:
##########
@@ -184,28 +190,40 @@ def __init__(
         """
         self.properties = properties
         self.uri = properties[URI]
+        self.session = requests.Session()
+        self._set_session_ssl_config()
 
         if credential := properties.get(CREDENTIAL):
             properties[TOKEN] = self._fetch_access_token(credential)
+
+        self._set_session_headers()
         super().__init__(name, **self._fetch_config(properties))
 
+    def _set_session_ssl_config(self):
+        """Sets the client side and server side SSL cert verification, if 
provided as properties."""
+        if ssl_config := self.properties.get(SSL):
+            if ssl_ca_bundle := ssl_config.get(CA_BUNDLE):
+                self.session.verify = ssl_ca_bundle
+            if ssl_client := ssl_config.get(CLIENT):
+                if all(k in ssl_client for k in (CERT, KEY)):
+                    self.session.cert = (ssl_client[CERT], ssl_client[KEY])
+                elif ssl_client_cert := ssl_client.get(CERT):
+                    self.session.cert = ssl_client_cert
+
     def _check_valid_namespace_identifier(self, identifier: Union[str, 
Identifier]) -> Identifier:
         """The identifier should have at least one element"""
         identifier_tuple = Catalog.identifier_to_tuple(identifier)
         if len(identifier_tuple) < 1:
             raise NoSuchNamespaceError(f"Empty namespace identifier: 
{identifier}")
         return identifier_tuple
 
-    @property
-    def headers(self) -> Properties:
-        headers = {
-            "Content-type": "application/json",
-            "X-Client-Version": ICEBERG_REST_SPEC_VERSION,
-            "User-Agent": f"PyIceberg/{__version__}",
-        }
+    def _set_session_headers(self):

Review Comment:
   Suggested changes pushed in recent commit. Please review.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to