From b9a7dd99dadb15910c9d35a9810c57286bcdfa53 Mon Sep 17 00:00:00 2001 From: Mouriya Date: Mon, 22 Jul 2024 16:40:52 +0900 Subject: [PATCH] =?UTF-8?q?fix=20534:=20=E3=83=AB=E3=83=BC=E3=83=97?= =?UTF-8?q?=E3=82=92=E4=BD=BF=E7=94=A8=E3=81=97=E3=81=A6=E3=82=A2=E3=83=97?= =?UTF-8?q?=E3=83=AA=E3=81=AE=E8=A9=B3=E7=B4=B0=E6=83=85=E5=A0=B1=E3=82=92?= =?UTF-8?q?=E5=8F=96=E5=BE=97=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/api/api_v1/routers/kintone.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/backend/app/api/api_v1/routers/kintone.py b/backend/app/api/api_v1/routers/kintone.py index 69f9db2..44fab0d 100644 --- a/backend/app/api/api_v1/routers/kintone.py +++ b/backend/app/api/api_v1/routers/kintone.py @@ -516,10 +516,25 @@ async def allapps(request:Request,c:config.KINTONE_ENV=Depends(getkintoneenv)): try: headers={config.API_V1_AUTH_KEY:c.API_V1_AUTH_VALUE} url = f"{c.BASE_URL}{config.API_V1_STR}/apps.json" - r = httpx.get(url,headers=headers) - return r.json() + offset = 0 + all_apps = [] + + while True: + r = httpx.get(f"{url}?limit=100&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: + offset += 100 + else: + break + else: + break + + return {"apps": all_apps} + except Exception as e: - raise APIException('kintone:allapps',request.url._url, f"Error occurred while get allapps({c.DOMAIN_NAME}):",e) + raise APIException('kintone:allapps', request.url._url, f"Error occurred while get allapps({c.DOMAIN_NAME}):", e) @r.get("/appfields") async def appfields(request:Request,app:str,env = Depends(getkintoneenv)):