小编yos*_*osi的帖子

如何使用python上传到google驱动器而无需身份验证?

我想使用 Google 脚本和 Python 将文件上传到 Google Drive。

我不想使用 API 执行此操作,因为它使用 JSON 文件并请求 google 帐户的密码。

我想从没有 JSON 文件的 Python 文件发送,并且不请求 google 帐户。

我想在谷歌脚本中创建一个脚本,将文件上传到网站。

我发现如何用 html 做到这一点:

function saveFile(data,name,folderName) { 
   var contentType = data.substring(5,data.indexOf(';'));

   var file = Utilities.newBlob(
     Utilities.base64Decode(data.substr(data.indexOf('base64,')+7)), 
     contentType, 
     name
   ); //does the uploading of the files
   DriveApp.getFolderById(childFolderIdA).createFile(file);
}

Run Code Online (Sandbox Code Playgroud)

但我没有找到如何用 python 做到这一点。

如何将文件与文件发送到此代码?

python web-applications google-apps-script google-drive-api

6
推荐指数
1
解决办法
2526
查看次数