youngtsai commited on
Commit
aaf5d8b
1 Parent(s): c3b5949

def copy_file_from_drive_to_gcs(drive_service, gcs_client, file_id, bucket_name, gcs_destination_path):

Browse files
Files changed (1) hide show
  1. app.py +7 -0
app.py CHANGED
@@ -124,6 +124,13 @@ def copy_all_files_from_drive_to_gcs(drive_service, gcs_client, drive_folder_id,
124
  gcs_destination_path = f"{gcs_folder_name}/{file_name}"
125
  copy_file_from_drive_to_gcs(drive_service, gcs_client, file_id, bucket_name, gcs_destination_path)
126
 
 
 
 
 
 
 
 
127
  # # ====drive====初始化Google Drive服务
128
  def init_drive_service():
129
  credentials_json_string = DRIVE_KEY
 
124
  gcs_destination_path = f"{gcs_folder_name}/{file_name}"
125
  copy_file_from_drive_to_gcs(drive_service, gcs_client, file_id, bucket_name, gcs_destination_path)
126
 
127
+ def copy_file_from_drive_to_gcs(drive_service, gcs_client, file_id, bucket_name, gcs_destination_path):
128
+ # Download file content from Drive
129
+ file_content = download_file_as_string(drive_service, file_id)
130
+ # Upload file content to GCS
131
+ upload_file_to_gcs(gcs_client, bucket_name, gcs_destination_path, file_content)
132
+
133
+
134
  # # ====drive====初始化Google Drive服务
135
  def init_drive_service():
136
  credentials_json_string = DRIVE_KEY