0

I am trying to upload a .mp4 file to my Drive using the following code.

file = drive.CreateFile({'title': "video", 'mimeType':'video/mp4'})
file.SetContentFile('GOPR1017.mp4')
file.Upload()

I end up getting this error:

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

This only occurs when trying to upload .mp4 files. The script seems to have no issue with .jpg.

Bogdan Andrei
  • 75
  • 1
  • 10
  • 1
    Check this post: https://stackoverflow.com/questions/60533230/pydrive-redirectmissinglocation-redirected-but-the-response-is-missing-a-locat – Mike67 Aug 01 '20 at 22:29

1 Answers1

0
file4 = drive.CreateFile({'title':'appdata.json', 
'mimeType':'application/json'})
file4.SetContentString('{"firstname": "John", "lastname": "Smith"}')
file4.Upload() # Upload file.
file4.SetContentString('{"firstname": "Claudio", "lastname": "Afshar"}')
file4.Upload() # Update content of the file.

file5 = drive.CreateFile()
# Read file and set it as a content of this instance.
file5.SetContentFile('cat.png')
file5.Upload() # Upload the file.
print('title: %s, mimeType: %s' % (file5['title'], file5['mimeType']))
# title: cat.png, mimeType: image/png
ARANGE
  • 1
  • 3
  • 2
    Please add some prose explaining the differences between your code and OP's. The goal is to explain what you did, not just provide code – Mad Physicist Aug 01 '20 at 23:09