• <bdo id='jniV7'></bdo><ul id='jniV7'></ul>

    <small id='jniV7'></small><noframes id='jniV7'>

  • <tfoot id='jniV7'></tfoot>
    <legend id='jniV7'><style id='jniV7'><dir id='jniV7'><q id='jniV7'></q></dir></style></legend>

        <i id='jniV7'><tr id='jniV7'><dt id='jniV7'><q id='jniV7'><span id='jniV7'><b id='jniV7'><form id='jniV7'><ins id='jniV7'></ins><ul id='jniV7'></ul><sub id='jniV7'></sub></form><legend id='jniV7'></legend><bdo id='jniV7'><pre id='jniV7'><center id='jniV7'></center></pre></bdo></b><th id='jniV7'></th></span></q></dt></tr></i><div id='jniV7'><tfoot id='jniV7'></tfoot><dl id='jniV7'><fieldset id='jniV7'></fieldset></dl></div>

        Google 云端硬盘 - 无法通过经过身份验证的 (OAut

        时间:2023-08-28
          <tbody id='biEVE'></tbody>
      1. <legend id='biEVE'><style id='biEVE'><dir id='biEVE'><q id='biEVE'></q></dir></style></legend>

          <small id='biEVE'></small><noframes id='biEVE'>

                • <bdo id='biEVE'></bdo><ul id='biEVE'></ul>

                • <tfoot id='biEVE'></tfoot>

                  <i id='biEVE'><tr id='biEVE'><dt id='biEVE'><q id='biEVE'><span id='biEVE'><b id='biEVE'><form id='biEVE'><ins id='biEVE'></ins><ul id='biEVE'></ul><sub id='biEVE'></sub></form><legend id='biEVE'></legend><bdo id='biEVE'><pre id='biEVE'><center id='biEVE'></center></pre></bdo></b><th id='biEVE'></th></span></q></dt></tr></i><div id='biEVE'><tfoot id='biEVE'></tfoot><dl id='biEVE'><fieldset id='biEVE'></fieldset></dl></div>
                  本文介绍了Google 云端硬盘 - 无法通过经过身份验证的 (OAuth2) 请求下载缩略图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  对于所有 Google 文档,我无法从文件响应返回的 ThumbnailLink 属性下载缩略图.

                  For all Google Docs, I'm not able to download the thumbnail image from the ThumbnailLink property returned with a file response.

                  我总是收到403 - Forbidden"错误页面,其中包含类似以下的消息:

                  I always receive a '403 - Forbidden' error page with a message similar to this:

                  您的客户端无权从该服务器获取 URL/thumbnailLink.

                  Your client does not have permission to get URL /thumbnailLink from this server.

                  (客户端IP地址:clientIP)

                  未经授权的用户

                  我尝试使用谷歌提供的类MediaDownloader.cs,我也尝试使用以下代码下载它:

                  I try to use the class MediaDownloader.cs provided by Google and I also try to download it by using this code:

                  using (Stream stream = service.HttpClient.GetStreamAsync(p_DownloadUrl).Result) {
                      StreamUtilities.Copy(p_WriteDelegate, stream.Read);
                  }
                  

                  其中服务"是正确实例化的 DriveService (IClientService) 对象.我可以用它来下载文件或提出任何其他请求.我使用Drive.Readonly"范围.

                  where 'service' is a DriveService (IClientService) object properly instantiated. I can use it to download the file or make any other requests. I use the 'Drive.Readonly' scope.

                  下载 Word、Excel、PDF 等文档的缩略图没有任何问题,因为这些链接是公开的,不需要任何类型的身份验证.

                  I didn't have any issue to download the Thumbnail for a Word, Excel, PDF, etc. documents, because these links are public and doesn't require any kind of authentication.

                  我做错了什么?

                  是否可以下载 Google Docs 文档的缩略图?

                  Is it possible to download the thumbnail for a Google Docs document?

                  推荐答案

                  我们最近进行了更改以解决此问题.请再次尝试您的代码,看看您是否仍然收到此错误.我能够运行以下代码来成功下载我的 Google 文档的缩略图.

                  We've recently made a change to fix this issue. Please try your code again and see if you are still getting this error. I was able to run the following code to successfully download a thumbnail of my Google Document.

                  # Get oauth credentials
                  ...
                  # Authorize an http object
                  http = httplib2.Http()
                  http = credentials.authorize(http)
                  
                  drive_service = build('drive', 'v2', http=http)
                  
                  # Google Document type ID
                  docId = '1ns9x5BMIZAeUR-eXerqgpaHBBGkl_-_KCVpVoV5opn8'
                  files = drive_service.files().get(fileId=docId).execute()
                  
                  thumbnailLink = files['thumbnailLink']
                  print 'Downloading thumbnail at: ', thumbnailLink
                  response, content = http.request(thumbnailLink)
                  print response.status
                  
                  with open('thumbnail.jpg', 'wb') as f:
                    f.write(content)
                  

                  这篇关于Google 云端硬盘 - 无法通过经过身份验证的 (OAuth2) 请求下载缩略图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:MVC 中的 GoogleWebAuthorizationBroker 用于 Google Drive 访 下一篇:如何通过 .NET 中的 Google Drive SDK 使用刷新令牌生

                  相关文章

                  最新文章

                    <bdo id='ic6XK'></bdo><ul id='ic6XK'></ul>

                • <i id='ic6XK'><tr id='ic6XK'><dt id='ic6XK'><q id='ic6XK'><span id='ic6XK'><b id='ic6XK'><form id='ic6XK'><ins id='ic6XK'></ins><ul id='ic6XK'></ul><sub id='ic6XK'></sub></form><legend id='ic6XK'></legend><bdo id='ic6XK'><pre id='ic6XK'><center id='ic6XK'></center></pre></bdo></b><th id='ic6XK'></th></span></q></dt></tr></i><div id='ic6XK'><tfoot id='ic6XK'></tfoot><dl id='ic6XK'><fieldset id='ic6XK'></fieldset></dl></div>

                  <small id='ic6XK'></small><noframes id='ic6XK'>

                  <legend id='ic6XK'><style id='ic6XK'><dir id='ic6XK'><q id='ic6XK'></q></dir></style></legend>
                  1. <tfoot id='ic6XK'></tfoot>