Fokko commented on code in PR #3418:
URL: https://github.com/apache/iceberg-python/pull/3418#discussion_r3922220587


##########
pyiceberg/catalog/rest/__init__.py:
##########
@@ -396,6 +403,92 @@ class ListViewsResponse(IcebergBaseModel):
 _PLANNING_RESPONSE_ADAPTER = TypeAdapter(PlanningResponse)
 
 
+class _RetryTimeoutHTTPAdapter(HTTPAdapter):
+    """HTTPAdapter that applies a default per-request timeout.
+
+    requests does not provide a way to set a default timeout on a Session;
+    without this adapter, every call would have to thread `timeout=` through.
+    The adapter applies `self._timeout` whenever a per-call timeout is not set.
+    """
+
+    def __init__(self, timeout: float | None = None, max_retries: Retry | int 
| None = None) -> None:
+        self._timeout = timeout
+        if max_retries is not None:
+            super().__init__(max_retries=max_retries)
+        else:
+            super().__init__()

Review Comment:
   We could import the default, and avoid the None check:
   
   ```
   from requests.adapters import DEFAULT_RETRIES
   ```
   
   And then simplify the check:
   
   ```suggestion
       def __init__(self, timeout: float | None = None, max_retries: Retry | 
int = DEFAULT_RETRIES) -> None:
           self._timeout = timeout
           super().__init__(max_retries=max_retries)
   ```



-- 
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