I'm using pyDrive library, and now I need to get xmls file and read it but I have an error
pydrive.files.FileNotDownloadableError: No downloadLink/exportLinks for mimetype found in metadata
white_list_xmls - my xmls file
My code:
tmp_name = None
with NamedTemporaryFile(delete=False, suffix='.xlsx') as tf:
tf.write(white_list_xmls.GetContentFile(white_list_xmls['title']))
tf.flush()
tmp_name = tf.name
if tmp_name is not None:
print(tmp_name)
then I change the code like this:
tmp_name = None
with NamedTemporaryFile(delete=False, suffix='.xlsx') as tf:
mimetypes = {
'application/vnd.google-apps.document': 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'application/vnd.google-apps.spreadsheet': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
}
if white_list_xmls['mimeType'] in mimetypes:
download_mimetype = mimetypes[white_list_xmls['mimeType']]
tf.write(white_list_xmls.GetContentFile(white_list_xmls['title'], mimetype=download_mimetype))
tf.flush()
tmp_name = tf.name
if tmp_name is not None:
print(tmp_name)
but I have an error too:
TypeError: a bytes-like object is required, not 'NoneType'