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:
@@ -262,6 +262,11 @@ class FileStationClient:
|
|||||||
info = self._api_cache[api]
|
info = self._api_cache[api]
|
||||||
resolved_version = version if version is not None else info["maxVersion"]
|
resolved_version = version if version is not None else info["maxVersion"]
|
||||||
url = f"{self._base_url}/webapi/{info['path']}"
|
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] = {
|
req_params: dict[str, Any] = {
|
||||||
"api": api,
|
"api": api,
|
||||||
@@ -295,6 +300,8 @@ class FileStationClient:
|
|||||||
|
|
||||||
code = body.get("error", {}).get("code", 0)
|
code = body.get("error", {}).get("code", 0)
|
||||||
logger.debug("DSM response: %s/%s — error code %d", api, method, code)
|
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)
|
# Transparent re-auth on session errors (one retry only)
|
||||||
if code in _SESSION_ERROR_CODES and not _is_retry and self._auth_manager:
|
if code in _SESSION_ERROR_CODES and not _is_retry and self._auth_manager:
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ def register_filestation(
|
|||||||
"limit": limit,
|
"limit": limit,
|
||||||
"sort_by": sort_by,
|
"sort_by": sort_by,
|
||||||
"sort_direction": sort_direction,
|
"sort_direction": sort_direction,
|
||||||
"additional": json.dumps(["size", "time"]),
|
# DEBUG: no additional — testing if any additional causes 408
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
except SynologyError as e:
|
except SynologyError as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user