def upload_file(name, file_id, parents): """ Uploads the new decrypted PDF file to the original file's folder in Google Drive. Calls the delete_file function :param name: the name of the new PDF file after decryption :param file_id: the id of the original file :param parents: the id of the folder that the original file is located in """ file_metadata = { 'name': name, 'mimeType': 'application/pdf', 'parents': parents } media = MediaFileUpload(name, mimetype='application/pdf') drive_service.files().create(body=file_metadata, media_body=media, fields='id').execute() media.__del__() delete_file(file_id)