Hook for Google Drive service
Module Contents
-
class
airflow.contrib.hooks.gdrive_hook.
GoogleDriveHook
(api_version='v3', gcp_conn_id='google_cloud_default', delegate_to=None)[source]
Bases: airflow.contrib.hooks.gcp_api_base_hook.GoogleCloudBaseHook
Hook for the Google Drive APIs.
- Parameters
api_version (str) – API version used (for example v3).
gcp_conn_id (str) – The connection ID to use when fetching connection info.
delegate_to (str) – The account to impersonate, if any.
For this to work, the service account making the request must have
domain-wide delegation enabled.
-
_conn
[source]
-
get_conn
(self)[source]
Retrieves the connection to Google Drive.
- Returns
Google Drive services object.
-
_ensure_folders_exists
(self, path)[source]
-
upload_file
(self, local_location, remote_location)[source]
Uploads a file that is available locally to a Google Drive service.
- Parameters
-
- Returns
File ID
- Return type
str