bug534:アプリ最大100件超える場合の対応
This commit is contained in:
@@ -517,20 +517,17 @@ async def allapps(request:Request,c:config.KINTONE_ENV=Depends(getkintoneenv)):
|
||||
headers={config.API_V1_AUTH_KEY:c.API_V1_AUTH_VALUE}
|
||||
url = f"{c.BASE_URL}{config.API_V1_STR}/apps.json"
|
||||
offset = 0
|
||||
limit = 100
|
||||
all_apps = []
|
||||
|
||||
while True:
|
||||
r = httpx.get(f"{url}?limit=100&offset={offset}", headers=headers)
|
||||
r = httpx.get(f"{url}?limit={limit}&offset={offset}", headers=headers)
|
||||
json_data = r.json()
|
||||
if "apps" in json_data:
|
||||
all_apps.extend(json_data["apps"])
|
||||
if len(json_data["apps"]) == 100:
|
||||
apps = json_data.get("apps",[])
|
||||
all_apps.extend(apps)
|
||||
if len(apps)<limit:
|
||||
break;
|
||||
offset += 100
|
||||
else:
|
||||
break
|
||||
else:
|
||||
break
|
||||
|
||||
return {"apps": all_apps}
|
||||
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user