pydrive:RedirectMissingLocation:已重定向,但响应缺少Location:标头 [英] pydrive: RedirectMissingLocation: Redirected but the response is missing a Location: header

查看:411
本文介绍了pydrive:RedirectMissingLocation:已重定向,但响应缺少Location:标头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要用新文件覆盖google drive文件夹中的现有文件.这就是我所拥有的.

I need to override an existing file inside a google drive folder with a new file. This is what I have.

file = drive.CreateFile({'id': <id_of_file_which_I_wish_to_overwrite>})
file.SetContentFile(<my_file_path>)
file.Upload()
print('title: %s, mimeType: %s' % (file5['title'], file5['mimeType']))

我不断从file.Upload()行中得到一个错误,例如:

I keep getting an error from file.Upload() line such as this:

RedirectMissingLocation: Redirected but the response is missing a Location: header.

是什么原因引起的?这个位置是什么或标题?我注意到当我运行没有file.SetContentFile的相同代码时,并没有更改此错误,而是仅更改文件元数据而不是覆盖它.

Any ideas of what's causing this? What this Location is or the header? I noticed that I am not getting this error when I run the same code without file.SetContentFile and instead only change file metadata instead of overwriting it.

推荐答案

您知道,PyDrive是google-api-python-client的包装库.

You know, PyDrive is a wrapper library of google-api-python-client.

根据此问题,存在一些问题在google-api-python-client和httplib2之间.

According to this issue, there is some problem between google-api-python-client and httplib2.

因此,请尝试安装0.1lib版本的httplib2. pip install httplib2==0.15.0

So try installing a 0.15.0 version of httplib2. pip install httplib2==0.15.0

这篇关于pydrive:RedirectMissingLocation:已重定向,但响应缺少Location:标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆