#1186·kaggle-cli

datasets files --format json prefixes stdout with pagination text

Author: ternausCreated Aug 29, 2026Updated Sep 14, 2026
Labelsenhancement

kaggle datasets files <owner>/<dataset> --page-size 1 --format json in CLI 2.2.4 writes a Next Page Token = ... line before the JSON array when the API response is paginated. This makes stdout invalid JSON for callers that use the documented JSON format.

Expected: stdout is valid JSON for --format json; pagination information can go to stderr or be represented in the JSON payload.

The source is KaggleApi.dataset_list_files_cli, which prints the page token before print_results(..., output_format=output_format).

I have a focused regression test and PR ready that preserves the token on stderr for JSON output and keeps the current stdout behavior for table/CSV output.