fix python scripts read offset (#13574)

Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
21pages
2025-11-20 22:15:42 +08:00
committed by GitHub
parent 7d06de00fb
commit 3787b45b49
5 changed files with 27 additions and 27 deletions

View File

@@ -34,9 +34,10 @@ def view(
devices = []
current = 1
current = 0
while True:
current += 1
params["current"] = current
response = requests.get(f"{url}/api/devices", headers=headers, params=params)
if response.status_code != 200:
@@ -61,8 +62,7 @@ def view(
devices.append(device)
total = response_json.get("total", 0)
current += pageSize
if len(data) < pageSize or current > total:
if len(data) < pageSize or current * pageSize >= total:
break
return devices