importosimporttempfilefromoffice365.sharepoint.client_contextimportClientContextfromoffice365.sharepoint.listitems.listitemimportListItemfromoffice365.sharepoint.lists.exporterimportExportListProgressfromtests.settingsimportcert_path,cert_thumbprint,client_id,site_url,tenantdefprint_progress(progress:ExportListProgress)->None:ifisinstance(progress.current_item,ListItem):print("List Item has been exported...")else:print("File has been downloaded...")print(f"Progress: {progress.processed_items}/{progress.total_items} items")ctx=ClientContext(site_url).with_client_certificate(tenant,client_id=client_id,thumbprint=cert_thumbprint,cert_path=cert_path)list_title="Orders"lib=ctx.web.lists.get_by_title(list_title)export_path=os.path.join(tempfile.mkdtemp(),f"{list_title}.zip")withopen(export_path,"wb")asf:lib.export(f,True,print_progress).execute_query()print(f"List has been export into {export_path} ...")