Is it possible to add local image to Slide using Google Slides API and Python?

后端 未结 2 1567
悲&欢浪女
悲&欢浪女 2021-01-25 16:59

I want to create a new slides out of the local images using Python. Unfortunately, I do not see an example to upload a local image, only an image URL via the official documenta

2条回答
  •  攒了一身酷
    2021-01-25 17:59

    Google requires a publicly accessible URL as mentioned in the docs.

    You can either:

    1. upload your file to an Internet-accessible server, or
    2. allow the Internet to access your local system.

    I'll describe the 2nd approach a bit because the 1st approach is fairly straight-forward.

    To allow Google to access your local file without uploading the file to a server, you can use a local HTTP server and expose it to the Internet using a TCP tunneling service like ngrok:

    https://ngrok.com/

    You can use any local server. If you don't have one, http-server on NPM is easy to use:

    https://www.npmjs.com/package/http-server

    I've used the ngrok approach successfully.

提交回复
热议问题