kevinjqliu commented on code in PR #2846:
URL: https://github.com/apache/iceberg-python/pull/2846#discussion_r2644611592
##########
pyiceberg/io/fsspec.py:
##########
@@ -121,9 +121,19 @@ def __call__(self, request: "AWSRequest", **_: Any) ->
None:
signer_url = self.properties.get(S3_SIGNER_URI,
self.properties[URI]).rstrip("/") # type: ignore
signer_endpoint = self.properties.get(S3_SIGNER_ENDPOINT,
S3_SIGNER_ENDPOINT_DEFAULT)
- signer_headers = {}
+ signer_headers: dict[str, str] = {}
+
+ auth_header: str | None = None
if token := self.properties.get(TOKEN):
- signer_headers = {"Authorization": f"Bearer {token}"}
+ auth_header = f"Bearer {token}"
Review Comment:
nit: maybe we can get rid of accessing `TOKEN` through properties here and
just standardize on using the auth manager.
##########
pyiceberg/io/fsspec.py:
##########
@@ -121,9 +121,19 @@ def __call__(self, request: "AWSRequest", **_: Any) ->
None:
signer_url = self.properties.get(S3_SIGNER_URI,
self.properties[URI]).rstrip("/") # type: ignore
signer_endpoint = self.properties.get(S3_SIGNER_ENDPOINT,
S3_SIGNER_ENDPOINT_DEFAULT)
- signer_headers = {}
+ signer_headers: dict[str, str] = {}
+
+ auth_header: str | None = None
if token := self.properties.get(TOKEN):
- signer_headers = {"Authorization": f"Bearer {token}"}
+ auth_header = f"Bearer {token}"
+ elif auth_manager := self.properties.get(AUTH_MANAGER):
+ header = getattr(auth_manager, "auth_header", None)
+ if callable(header):
+ auth_header = header()
Review Comment:
```suggestion
auth_header = auth_manager.auth_header()
```
could we just call the function directly? this will fail if the
`auth_header` function does not exist.
i think the current solution will fail silently, i.e. not add any auth
header if the `auth_header` function does not exist
--
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]