add filename exceptions

This commit is contained in:
guidotheelen 2020-04-20 14:57:01 +02:00
parent 2a87f618be
commit e6e8aacc0a

View file

@ -146,6 +146,8 @@ def download_files(service, file_list, output_dir):
file_id = file['id']
filename = file['name']
if "emoji_u" in filename and ".png" in filename:
request = service.files().get_media(fileId=file_id)
fh = io.BytesIO()
downloader = MediaIoBaseDownload(fh, request)
@ -169,6 +171,9 @@ def download_files(service, file_list, output_dir):
with open(filelocation, "wb") as f:
f.write(fh.getbuffer())
else:
print(f"{filename} does not have a valid emoji name")
def report_on_download(output_dir):
"""Summarize the process and print findings."""