Python google drive API 下载,文件在哪里?

Python google drive API download, where is file?(Python google drive API 下载,文件在哪里?)
本文介绍了Python google drive API 下载,文件在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我使用此处找到的 python 代码下载了谷歌驱动器上的文件:https://developers.google.com/drive/v3/web/manage-downloads我有这个范围:https://www.googleapis.com/auth/drive一切似乎都有效,我读到:

I used the python code found here to download a file on google drive: https://developers.google.com/drive/v3/web/manage-downloads I have this scope: https://www.googleapis.com/auth/drive everything seems to work, I read:

Download 35%.
Download 71%.
Download 100%.

但是文件在哪里?在与python文件相同的目录中,没有任何东西,既不是根目录,也不是主目录……你有想法吗?或者我该如何调试?

but where is the file? in the same directory as the python file, there is nothing, neither the root, nor in the home ... you have ideas? or alternatively how can I debug?

推荐答案

Google doc 使用示例

Example in Google doc uses

fh = io.BytesIO()

所以它将数据读入内存,而不是保存在磁盘上.

so it reads data into memory and it doesn't save on disk.

您必须使用(例如)保存它

You have to save it using (for example)

open(..., 'wb')
write(fh)
close()

<小时>

编辑:其他人的信息 - 正如@michelle.70 发现的那样 - 我们可以使用


EDIT: information for others - as @michelle.70 found - we can use

fh = io.FileIO(filename, 'wb') 

而不是 fh = io.BytesIO()

这篇关于Python google drive API 下载,文件在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

groupby multiple coords along a single dimension in xarray(在xarray中按单个维度的多个坐标分组)
Group by and Sum in Pandas without losing columns(Pandas中的GROUP BY AND SUM不丢失列)
Is there a way of group by month in Pandas starting at specific day number?( pandas 有从特定日期开始的按月分组的方式吗?)
Group by + New Column + Grab value former row based on conditionals(GROUP BY+新列+基于条件的前一行抓取值)
Groupby and interpolate in Pandas(PANDA中的Groupby算法和插值算法)
Pandas - Group Rows based on a column and replace NaN with non-null values(PANAS-基于列对行进行分组,并将NaN替换为非空值)