debug: log raw DSM error response and API version; remove additional from list_dir

Diagnostic build to identify root cause of 408 on list_dir:
- client.py: log resolved version + NAS maxVersion before every request
- client.py: log full raw body on every error response
- tools/filestation.py: remove additional parameter entirely to test if
  any additional field triggers 408, or if the issue is elsewhere

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-14 08:52:41 +02:00
parent 3a8332da95
commit e6c0acd779
2 changed files with 8 additions and 1 deletions
+7
View File
@@ -262,6 +262,11 @@ class FileStationClient:
info = self._api_cache[api]
resolved_version = version if version is not None else info["maxVersion"]
url = f"{self._base_url}/webapi/{info['path']}"
sys.stderr.write(
f"[dsm] REQUEST {api}/{method} v{resolved_version} "
f"(NAS max={info['maxVersion']})\n"
)
sys.stderr.flush()
req_params: dict[str, Any] = {
"api": api,
@@ -295,6 +300,8 @@ class FileStationClient:
code = body.get("error", {}).get("code", 0)
logger.debug("DSM response: %s/%s — error code %d", api, method, code)
sys.stderr.write(f"[dsm] RAW ERROR {api}/{method}: {body!r}\n")
sys.stderr.flush()
# Transparent re-auth on session errors (one retry only)
if code in _SESSION_ERROR_CODES and not _is_retry and self._auth_manager:
@@ -151,7 +151,7 @@ def register_filestation(
"limit": limit,
"sort_by": sort_by,
"sort_direction": sort_direction,
"additional": json.dumps(["size", "time"]),
# DEBUG: no additional — testing if any additional causes 408
},
)
except SynologyError as e: