diff --git a/pyproject.toml b/pyproject.toml index 048eae4..870c307 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "dapla-toolbelt" -version = "2.0.5" +version = "2.0.6" description = "Dapla Toolbelt" authors = ["Dapla Developers "] license = "MIT" diff --git a/src/dapla/files.py b/src/dapla/files.py index 305419d..dcb0340 100644 --- a/src/dapla/files.py +++ b/src/dapla/files.py @@ -47,9 +47,7 @@ def get_gcs_file_system(**kwargs: Any) -> GCSFileSystem: See https://gcsfs.readthedocs.io/en/latest for advanced usage """ - return GCSFileSystem( - token=AuthClient.fetch_google_credentials().token, **kwargs - ) + return GCSFileSystem(token=AuthClient.fetch_google_credentials(), **kwargs) @staticmethod def ls(gcs_path: str, detail: bool = False, **kwargs: Any) -> Any: diff --git a/src/dapla/gcs.py b/src/dapla/gcs.py index 8d41c85..f82827e 100644 --- a/src/dapla/gcs.py +++ b/src/dapla/gcs.py @@ -3,13 +3,14 @@ from typing import Optional import gcsfs +from google.oauth2.credentials import Credentials class GCSFileSystem(gcsfs.GCSFileSystem): # type: ignore [misc] """GCSFileSystem is a wrapper around gcsfs.GCSFileSystem.""" def __init__( - self, token: Optional[dict[str, str] | str] = None, **kwargs: Any + self, token: Optional[dict[str, str] | str | Credentials] = None, **kwargs: Any ) -> None: """Initialize GCSFileSystem.""" super().__init__(token=token, **kwargs)