Skip to content

Instantly share code, notes, and snippets.

View kevinlin311tw's full-sized avatar

Kevin Ke-Yun Lin kevinlin311tw

View GitHub Profile
@csik
csik / gdrive_dl.py
Last active November 4, 2020 05:11
Download Large Files from Google Drive
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
"""API calls to download a very large google drive file. The drive API only allows downloading to ram
(unlike, say, the Requests library's streaming option) so the files has to be partially downloaded
and chunked. Authentication requires a google api key, and a local download of client_secrets.json
Thanks to Radek for the key functions: http://stackoverflow.com/questions/27617258/memoryerror-how-to-download-large-file-via-google-drive-sdk-using-python
"""