You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2022/07/31 21:29:32 UTC
[GitHub] [iceberg] Fokko commented on a diff in pull request #5402: Python: Follow up on REST comments
Fokko commented on code in PR #5402:
URL: https://github.com/apache/iceberg/pull/5402#discussion_r934041666
##########
python/pyiceberg/catalog/rest.py:
##########
@@ -200,32 +196,36 @@ def _split_credential(token: str) -> Tuple[str, str]:
@property
def headers(self) -> Properties:
- return {
- AUTHORIZATION_HEADER: f"{BEARER_PREFIX} {self.token}",
+ headers = {
"Content-type": "application/json",
"X-Client-Version": __version__,
}
+ if self.token:
+ headers[AUTHORIZATION_HEADER] = f"{BEARER_PREFIX} {self.token}"
+ return headers
- def url(self, endpoint: str, prefixed: bool = True, **kwargs) -> str:
+ def url(self, uri: str, prefixed: bool = True, **kwargs) -> str:
"""Constructs the endpoint
Args:
+ uri: Resource identifier that points to the REST catalog
prefixed: If the prefix return by the config needs to be appended
Returns:
The base url of the rest catalog
"""
- url = self.host
+ url = self.uri
url = url + "v1/" if url.endswith("/") else url + "/v1/"
if prefixed:
url += self.config.get(PREFIX, "")
url = url if url.endswith("/") else url + "/"
- return url + endpoint.format(**kwargs)
+ return url + uri.format(**kwargs)
Review Comment:
Fair point, I've reverted it 👍🏻
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org