繁体   English   中英

错误403使用Python将文件上传到Google文档

[英]Error 403 uploading a file to Google Docs with Python

尝试使用Python / gdata-2.0.13将文件上传到Google文档时,我遇到403错误:

import gdata.docs.data
import gdata.docs.client

client = gdata.docs.client.DocsClient(source="MyUpdater")
client.ClientLogin("mymail@gmail.com", "mykey", client.source);
client.http_client_debug = True

ms = gdata.data.MediaSource(file_path="g:/Python/Utiles/test.doc", content_type="application/msword'")
entry = client.Upload(ms, "Test File")

# Error:
gdata.client.RequestError: Server responded with: 403, <errors xmlns='http://sch
emas.google.com/g/2005'><error><domain>GData</domain><code>ServiceForbiddenExcep
tion</code><internalReason>You do not have permission to perform this operation.
</internalReason></error></errors>
...

我试过下载文件,没有问题。 我使用的是常规Gmail帐户(例如,没有Google Apps或付费帐户)。

有任何想法吗? TIA,巴勃罗

import gdata.docs.service
import gdata.docs.data

client = gdata.docs.service.DocsService()
client.ClientLogin("me@gmail.com", 'pass', 'test')

ms = gdata.data.MediaSource(file_path="/home/jake/Desktop/test.txt",
                            content_type=gdata.docs.service.SUPPORTED_FILETYPES['TXT'])
entry = client.Upload(ms, "Test File")

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM