I am trying to understand why this function call to download_file() keeps throwing an error. Can someone help me understand why this is the case?
'''
def get_files():
results = service.files().list(
pageSize=10, fields="nextPageToken, files(id, name, mimeType)").execute()
items = results.get('files', [])
return items
def download_file(id, filename, mimeType):
file_id = id
request = get_files()
fh = io.FileIO(filename, 'wb')
downloader = MediaIoBaseDownload(fh, request)
done = False
while done is False:
status, done = downloader.next_chunk()
print("Download {}%.".format(int(status.progress() * 100)))
print("Done")
return fh.getvalue()
def download_all_files():
files = get_files()
for file in files:
id = file['id']
name = file['name']
the_type = file['mimeType']
#print(file['id'], file['name'], file['mimeType'])
download_file(id, name, the_type)
#Calls
download_all_files()
'''
AttributeError: 'list' object has no attribute 'uri'