Warning

This document is for an in-development version of Galaxy. You can alternatively view this page in the latest release if it exists or view the top of the latest release's documentation.

Source code for galaxy.files.sources.googledrive

try:
    from fs.googledrivefs import GoogleDriveFS
    from google.oauth2.credentials import Credentials
except ImportError:
    GoogleDriveFS = None

from typing import Optional

from . import FilesSourceOptions
from ._pyfilesystem2 import PyFilesystem2FilesSource


[docs]class GoogleDriveFilesSource(PyFilesystem2FilesSource): plugin_type = "googledrive" required_module = GoogleDriveFS required_package = "fs.googledrivefs" def _open_fs(self, user_context=None, opts: Optional[FilesSourceOptions] = None): props = self._serialization_props(user_context) access_token = props.pop("oauth2_access_token") if access_token: props["token"] = access_token credentials = Credentials(**props) handle = GoogleDriveFS(credentials) return handle
__all__ = ("GoogleDriveFilesSource",)