refactor: 恢复所有审计API调用

This commit is contained in:
RockChinQ
2024-01-31 00:02:19 +08:00
parent c1c751a9ab
commit 32162afa65
11 changed files with 172 additions and 48 deletions

View File

@@ -38,6 +38,7 @@ class APIGroup(metaclass=abc.ABCMeta):
url = self.prefix + path
data = json.dumps(data)
headers['Content-Type'] = 'application/json'
try:
async with aiohttp.ClientSession() as session:
async with session.request(
@@ -49,7 +50,7 @@ class APIGroup(metaclass=abc.ABCMeta):
**kwargs
) as resp:
self.ap.logger.debug("data: %s", data)
self.ap.logger.debug("ret: %s", await resp.json())
self.ap.logger.debug("ret: %s", await resp.text())
except Exception as e:
self.ap.logger.debug(f'上报失败: {e}')

View File

@@ -9,7 +9,7 @@ class V2MainDataAPI(apigroup.APIGroup):
def __init__(self, prefix: str, ap: app.Application):
self.ap = ap
super().__init__(prefix+"/usage", ap)
super().__init__(prefix+"/main", ap)
async def do(self, *args, **kwargs):
config = self.ap.cfg_mgr.data

View File

@@ -9,7 +9,7 @@ class V2PluginDataAPI(apigroup.APIGroup):
def __init__(self, prefix: str, ap: app.Application):
self.ap = ap
super().__init__(prefix+"/usage", ap)
super().__init__(prefix+"/plugin", ap)
async def do(self, *args, **kwargs):
config = self.ap.cfg_mgr.data