Fokko commented on code in PR #5488:
URL: https://github.com/apache/iceberg/pull/5488#discussion_r947199819
##########
python/pyiceberg/catalog/rest.py:
##########
@@ -210,8 +199,8 @@ def headers(self) -> Properties:
"Content-type": "application/json",
"X-Client-Version": __version__,
}
- if self.token:
- headers[AUTHORIZATION_HEADER] = f"{BEARER_PREFIX} {self.token}"
+ if token := self.properties.get("token"):
Review Comment:
I've added a docstring to the property function:
```python
def property(self, key: str) -> str:
"""Returns a property from the properties variable. If it doesn't exist,
it will raise an error.
Args:
key: The key of the property
Returns: The value of the property
Raises:
ValueError: When the property cannot be found, with a pointer on how
to set the property.
"""
if key not in self.properties:
raise ValueError(
f"{type(self).__name__} expects an {key} property. Please set in
config or using environment variable
PYICEBERG_CATALOG__{self.name.upper()}__{key.upper()}"
)
return self.properties[key]
```
A token isn't required, for example, when authentication is disabled on the
rest catalog.
--
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]