Download multiple dataset files

DownloadMultipleDatasetFiles.py

import tempfile
from datetime import datetime, timedelta

from LOGS import LOGS
from LOGS.Entities import DatasetRequestParameter

# Connect to LOGS
logs = LOGS()

# Create an temporary directory
targetDirectory = tempfile.mkdtemp()

# Get the datasets iterator for all dataset uploaded in the last two weeks
datasets = logs.datasets(
    DatasetRequestParameter(createdFrom=datetime.now() - timedelta(days=14))
)

# When download is executed on a iterator the files will be compiled into one zip file on the server and then downloaded.
zipFile = datasets.download()
print("Datasets files were downloaded into %a" % zipFile)