为什么调用Google Slides API返回错误?

时间:2020-01-15 23:07:46

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

我基本上一直在使用此代码将图像加载到Google云端硬盘中,然后使用Python将其转移到Google幻灯片上,由于某种原因,该图像今天停止工作。

我基于的代码位于: 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是否有任何更改?

3 个答案:

答案 0 :(得分:0)

我遇到了同样的问题。您应该查看以下链接,该链接描述了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

答案 1 :(得分:0)

您在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.">

每次尝试使用 createImage replaceAllShapesWithImage 推入Google幻灯片中的任何图像时,都会发生错误。

请注意,指向Google云端硬盘内容的URL与公开内容相关。因此,@ miladio上面提到的变通办法目前无济于事。

答案 2 :(得分:0)

在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.">