# Create a file handle to write to fh = io.FileIO(file_name, 'wb')
curl -H "Authorization: Bearer $ACCESS_TOKEN" \ "https://www.googleapis.com/drive/v3/files/$FILE_ID/export?mimeType=application/pdf" \ --output document.pdf google drive api download
For Google Workspace files (Docs, Sheets, Slides), the ID is in the URL: # Create a file handle to write to fh = io
fh = io.FileIO(file_name, 'wb') downloader = MediaIoBaseDownload(fh, request) 'wb') downloader = MediaIoBaseDownload(fh