Skip to content

Commit 05b430e

Browse files
committed
Deprecate rest.authorization-url in favor of oauth2-server-uri
1 parent 861c563 commit 05b430e

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

pyiceberg/catalog/rest.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
CommitTableRequest,
6464
CommitTableResponse,
6565
CreateTableTransaction,
66+
PropertyUtil,
6667
StagedTable,
6768
Table,
6869
TableIdentifier,
@@ -71,6 +72,7 @@
7172
from pyiceberg.table.sorting import UNSORTED_SORT_ORDER, SortOrder, assign_fresh_sort_order_ids
7273
from pyiceberg.typedef import EMPTY_DICT, UTF8, IcebergBaseModel, Identifier, Properties
7374
from pyiceberg.types import transform_dict_value_to_str
75+
from pyiceberg.utils.deprecated import deprecated
7476

7577
if TYPE_CHECKING:
7678
import pyarrow as pa
@@ -118,7 +120,8 @@ class Endpoints:
118120
SIGV4 = "rest.sigv4-enabled"
119121
SIGV4_REGION = "rest.signing-region"
120122
SIGV4_SERVICE = "rest.signing-name"
121-
AUTH_URL = "rest.authorization-url"
123+
DEPRECATED_AUTH_URL = "rest.authorization-url"
124+
OAUTH2_SERVER_URI = "oauth2-server-uri"
122125
HEADER_PREFIX = "header."
123126

124127
NAMESPACE_SEPARATOR = b"\x1f".decode(UTF8)
@@ -290,7 +293,14 @@ def url(self, endpoint: str, prefixed: bool = True, **kwargs: Any) -> str:
290293

291294
@property
292295
def auth_url(self) -> str:
293-
if url := self.properties.get(AUTH_URL):
296+
if self.properties.get(DEPRECATED_AUTH_URL):
297+
deprecated(
298+
deprecated_in="0.7.0",
299+
removed_in="0.8.0",
300+
help_message=f"The property {DEPRECATED_AUTH_URL} is deprecated. Please use {OAUTH2_SERVER_URI} instead",
301+
)(lambda: None)()
302+
303+
if url := PropertyUtil.get_first_property_value(self.properties, DEPRECATED_AUTH_URL, OAUTH2_SERVER_URI):
294304
return url
295305
else:
296306
return self.url(Endpoints.get_token, prefixed=False)

tests/catalog/test_rest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
import pyiceberg
2626
from pyiceberg.catalog import PropertiesUpdateSummary, load_catalog
27-
from pyiceberg.catalog.rest import AUTH_URL, RestCatalog
27+
from pyiceberg.catalog.rest import OAUTH2_SERVER_URI, RestCatalog
2828
from pyiceberg.exceptions import (
2929
AuthorizationExpiredError,
3030
NamespaceAlreadyExistsError,
@@ -235,7 +235,7 @@ def test_token_200_w_auth_url(rest_mock: Mocker) -> None:
235235
)
236236
# pylint: disable=W0212
237237
assert (
238-
RestCatalog("rest", uri=TEST_URI, credential=TEST_CREDENTIALS, **{AUTH_URL: TEST_AUTH_URL})._session.headers[
238+
RestCatalog("rest", uri=TEST_URI, credential=TEST_CREDENTIALS, **{OAUTH2_SERVER_URI: TEST_AUTH_URL})._session.headers[
239239
"Authorization"
240240
]
241241
== f"Bearer {TEST_TOKEN}"

0 commit comments

Comments
 (0)