[英]Cannot download files using Google Drive API in Go
I am trying to download some *.FIT files using Google Drive API for Go, from a private folder stored in my Google Drive.我正在尝试使用 Google Drive API for Go 从存储在我的 Google Drive 中的私人文件夹下载一些 *.FIT 文件。 (Garmin 310XT data)
(Garmin 310XT 数据)
I have followed the wizard and guide found here , and have successfully obtained a full list of files from a folder by id.我遵循了此处找到的向导和指南,并已成功通过 id 从文件夹中获取了完整的文件列表。
I am using this sample code , but I cannot download any of the files.我正在使用此示例代码,但无法下载任何文件。 Both the file DownloadUrl and the ExportFormats properties are always empty.
文件 DownloadUrl 和 ExportFormats 属性始终为空。 Has anyone successfully done this, or am I just missing something important?
有没有人成功地做到了这一点,或者我只是错过了一些重要的东西?
Edit: The first problem was about scope, but after changing it to drive.DriveScope I can only download 0 byte files.编辑:第一个问题是关于范围,但将其更改为 drive.DriveScope 后,我只能下载 0 字节文件。
Using the correct http.RoundTripper solved the 0 byte size issue.使用正确的 http.RoundTripper 解决了 0 字节大小的问题。 (client.Transport)
(客户端。传输)
Is the file restricted?文件是否受限?
See files docs under labels.restricted
查看
labels.restricted
下的文件文档
labels.restricted
boolean
Whether viewers and commenters are prevented from downloading, printing, and copying this file. labels.restricted
boolean
是否禁止查看者和评论者下载、打印和复制此文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.