This is an automated email from the ASF dual-hosted git repository.
fokko pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-python.git
The following commit(s) were added to refs/heads/main by this push:
new 11af14be6 Surface too many requests exception (#3048)
11af14be6 is described below
commit 11af14be6d36f717ddffe8deed8f5c836196b17c
Author: Marcin SzymaĆski <[email protected]>
AuthorDate: Wed Feb 18 14:23:09 2026 +0000
Surface too many requests exception (#3048)
# Rationale for this change
Currently there's no way to catch just the HTTP code 429
## Are these changes tested?
## Are there any user-facing changes?
No
---
pyiceberg/catalog/rest/response.py | 3 +++
pyiceberg/exceptions.py | 4 ++++
2 files changed, 7 insertions(+)
diff --git a/pyiceberg/catalog/rest/response.py
b/pyiceberg/catalog/rest/response.py
index 157e4bfa1..9c1c33dac 100644
--- a/pyiceberg/catalog/rest/response.py
+++ b/pyiceberg/catalog/rest/response.py
@@ -28,6 +28,7 @@ from pyiceberg.exceptions import (
RESTError,
ServerError,
ServiceUnavailableError,
+ TooManyRequestsError,
UnauthorizedError,
)
from pyiceberg.typedef import IcebergBaseModel
@@ -79,6 +80,8 @@ def _handle_non_200_response(exc: HTTPError, error_handler:
dict[int, type[Excep
exception = RESTError
elif code == 419:
exception = AuthorizationExpiredError
+ elif code == 429:
+ exception = TooManyRequestsError
elif code == 501:
exception = NotImplementedError
elif code == 503:
diff --git a/pyiceberg/exceptions.py b/pyiceberg/exceptions.py
index e755c7309..6bf9380a3 100644
--- a/pyiceberg/exceptions.py
+++ b/pyiceberg/exceptions.py
@@ -84,6 +84,10 @@ class AuthorizationExpiredError(RESTError):
"""When the credentials are expired when performing an action on the REST
catalog."""
+class TooManyRequestsError(RESTError):
+ """Raises when too many requests error is returned by the REST catalog."""
+
+
class OAuthError(RESTError):
"""Raises when there is an error with the OAuth call."""