【问题标题】:Why call of Google Slides API returns error?为什么调用 Google Slides API 返回错误?
【发布时间】:2020-01-15 23:07:46
【问题描述】:

我基本上一直在使用此代码将图像加载到 Google Drive,然后使用 Python 将该图像传输到 Google Slides,但由于某种原因它今天停止工作。

我基于我的代码位于此处: http://wescpy.blogspot.com/2016/11/using-google-slides-api-with-python.html

但是,今天我重新运行它并收到错误:

googleapiclient.errors.HttpError:https://slides.googleapis.com/v1/presentations/PRESENTATION_ID 返回“无效请求[0].createImage:禁止访问所提供的图像。”

我想知道 Google API 是否有任何变化?

【问题讨论】:

  • 您好,您仍然收到错误消息吗?我刚刚试了一下,效果很好。
  • 它看起来今天还在工作,很奇怪。一行代码我都没改
  • 我遇到了同样的错误......奇怪的是,今天早上,截至 2020 年 5 月 2 日,相同的代码运行良好。我想这是 Google 内部错误,但我不能保证任何事情
  • 这里有同样的问题。我以为这就是我所做的
  • 几个小时前我没有这个错误,现在有了。那很奇怪。我这边的代码没有变化。

标签: python-3.x google-api google-oauth google-slides-api


【解决方案1】:

2020 年 3 月 6 日,您今天是否遇到同样的错误?

<HttpError 400 when requesting https://slides.googleapis.com/v1/presentations/6-7HI:batchUpdate?fields=&alt=json returned "Invalid requests[24].createImage: Access to the provided image was forbidden.">

每次我尝试使用 createImagereplaceAllShapesWithImage 推送存储在 Google 幻灯片中的任何图像时都会发生错误。

请注意,指向 Google Drive 内容的 URL 与公共内容相关。因此,@miladio 提到的上述解决方法目前没有用。

【讨论】:

    【解决方案2】:

    2020-05-17 再次出现错误:

    在此之前,它一直在完美地使用更新以将图像添加到驱动器 -> 打开权限 -> 将其从驱动器复制到幻灯片 -> 关闭权限。

    googleapiclient.errors.HttpError: <HttpError 400 when requesting https://slides.googleapis.com/v1/presentations/<SLIDE_ID>?alt=json returned "Invalid requests[152].createImage: Access to the provided image was forbidden.">
    

    【讨论】:

      【解决方案3】:

      我遇到了同样的问题。您应该查看此链接,该链接描述了 Drive API 的更改:Upcoming changes to the Google Drive API and Google Picker API

      这里提出的解决方案似乎可行,虽然我自己还没有完全测试过:Google script replaceAllShapesWithImage with image from drive doesn"t work any more

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2019-05-12
        • 1970-01-01
        • 1970-01-01
        • 2021-08-12
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多