如何撤销已授予我的Google云端硬盘网络应用程序的访问权限,以便在用户下次使用时重新要求他获得权限?
我用google appengine创建了一个表单和一个简单的服务器,用于将任意文件类型上传到我的google驱动器.该表单无法用于某些文件类型,只是给出了此错误:
HttpError: <HttpError 400 when requesting https://www.googleapis.com/upload/drive/v1/files?alt=json returned "Unsupported content with type: application/pdf">
Run Code Online (Sandbox Code Playgroud)
是不是支持pdf文件?
上传的appengine代码有点像这样:
def upload_to_drive(self, filestruct):
resource = {
'title': filestruct.filename,
'mimeType': filestruct.type,
}
resource = self.service.files().insert(
body=resource,
media_body=MediaInMemoryUpload(filestruct.value,
filestruct.type),
).execute()
def post(self):
creds = StorageByKeyName(Credentials, my_user_id, 'credentials').get()
self.service = CreateService('drive', 'v1', creds)
post_dict = self.request.POST
for key in post_dict.keys():
if isinstance(post_dict[key], FieldStorage):#might need to import from cgi
#upload to drive and return link
self.upload_to_drive(post_dict[key]) #TODO: there should be error handling here
Run Code Online (Sandbox Code Playgroud)
我已经成功地将它用于MS Office文档和图像.它也不适用于文本文件并提供此错误:
HttpError: <HttpError 400 …Run Code Online (Sandbox Code Playgroud) 我想知道是否有任何方法(阅读:hacks)使用Google Spreadsheet API,并没有强制限制将标题行中的值设置为小写而没有空格.我知道我可以使用基于单元格的Feed,但是我的应用程序必须跟踪哪个列号对应于特定列名称.
有没有人有另类手段?
(另外我注意到Google Spreadsheet API Docs没有提到标题行名称限制,我不得不四处搜索,找出我的代码最初没有工作的原因)