Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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']))

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

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

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.

like image 222
user10467920 Avatar asked Nov 07 '25 16:11

user10467920


1 Answers

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

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

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

like image 151
blurfx Avatar answered Nov 12 '25 17:11

blurfx



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!