From 7ee39670474bdde6de42070e5b82019ce4b5d5b8 Mon Sep 17 00:00:00 2001 From: Zzaphkiel Date: Thu, 7 Nov 2024 20:02:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=80=E9=94=AE=E7=AC=A6?= =?UTF-8?q?=E6=96=87=E5=8A=9F=E8=83=BD=E6=9C=89=E6=A6=82=E7=8E=87=E5=A4=B1?= =?UTF-8?q?=E6=95=88=E7=9A=84=E9=97=AE=E9=A2=98=20(#435)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/lol/connector.py | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/app/lol/connector.py b/app/lol/connector.py index 114767a..8f4f649 100644 --- a/app/lol/connector.py +++ b/app/lol/connector.py @@ -6,6 +6,7 @@ import subprocess import threading import time +import traceback from asyncio import CancelledError from collections import deque @@ -912,7 +913,6 @@ async def getReadyCheckStatus(self): return await res.json() - @retry() async def getCurrentRunePage(self): res = await self.__get("/lol-perks/v1/currentpage") @@ -920,14 +920,20 @@ async def getCurrentRunePage(self): @retry() async def deleteCurrentRunePage(self): - page = await self.getCurrentRunePage() + try: + page = await self.getCurrentRunePage() + + res = None + if page.get('isDeletable'): + id = page['id'] - res = None - if page.get('isDeletable'): - id = page['id'] + res = await self.__delete(f"/lol-perks/v1/pages/{id}") + res = await res.json() - res = await self.__delete(f"/lol-perks/v1/pages/{id}") - res = await res.json() + except Exception as e: + stack = traceback.format_exc() + logger.error( + f"deleteCurrentRunePage error {stack = }, {e =}", TAG) @retry() async def createRunePage(self, name, primaryId, secondaryId, perks): @@ -940,7 +946,7 @@ async def createRunePage(self, name, primaryId, secondaryId, perks): } res = await self.__post("/lol-perks/v1/pages", data=body) - return await res.json() + res = await res.json() async def spectate(self, summonerName): info = await self.getSummonerByName(summonerName)