python - 直接链接到 Google Drive Image 不起作用 [在 CodeSkulptor 中]

标签 python google-drive-api codeskulptor

我已上传到谷歌驱动器和保管箱(公共(public)文件夹)图像,但未加载为什么当我访问谷歌驱动器的公共(public)网址时给出错误消息(403。这是一个错误。

您的客户端无权从此服务器获取 URL/U7NFy4SAHqDw6I3-Yd11AG2fi5QaCiIsn62wqOJO0gPRO68G5yfGurFiVm75HezqRtmrwlE33lxRyTF6。 (客户端IP地址:103.21.166.13)

ACL 被拒绝 这就是我们所知道的。)

这是我的 codekulptor 代码。

import simplegui

message = "Welcome!"

# Handler for mouse click

image = simplegui.load_image('https://drive.google.com/file/d/0Bworipp9D5BbQ0t1aVE2NDlsaXc/edit?usp=sharing')
# Handler to draw on canvas
def draw(canvas):
    canvas.draw_image(image, (596, 25), (1192, 50), (100, 100), (128, 128))
    print image.get_width();
    print image.get_height();
# Create a frame and assign callbacks to event handlers
frame = simplegui.create_frame("Home", 300, 200)

frame.set_draw_handler(draw)

# Start the frame animation
frame.start()

最佳答案

Google 云端硬盘不会为上传的文件提供直接链接。
可以通过更改以下网址来规避此问题:

https://drive.google.com/file/d/0Bworipp9D5BbQ0t1aVE2NDlsaXc/edit?usp=sharing

至:

https://docs.google.com/uc?export=download&id=0B8w52Vdma1fVMDhiZmlieEJxQ28


您可以看到,这是基于以下 URL 的通用模板,您只需在原始链接中插入文件 ID:

https://docs.google.com/uc?export=download&id=

来源:Google 论坛。

关于python - 直接链接到 Google Drive Image 不起作用 [在 CodeSkulptor 中],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22173237/

相关文章:

python - Django 应用程序的 Heroku 等价物是什么?

python - manage.py createsuperuser 不适用于自定义用户模型

google-drive-api - 谷歌文档 API v3 : Updating a document removes it from shared folder

c# - 集成谷歌云端硬盘

python - 如何获取 CSV 文件的键作为列表?

python - 检查列表的所有元素是否属于同一类型

google-chrome-extension - 将文件从 Chrome 扩展程序保存到 Google Drive

python - 我的标题覆盖了窗口中的图像(Python)

python - 我们可以在 codeskulptor 中创建和导入模块吗?