feat: 改为同步

This commit is contained in:
RockChinQ
2023-12-21 16:48:50 +08:00
parent b8776fba65
commit 7c6526d1ea
7 changed files with 34 additions and 39 deletions
+10 -11
View File
@@ -2,7 +2,7 @@ import abc
import uuid
import json
import aiohttp
import requests
class APIGroup(metaclass=abc.ABCMeta):
@@ -28,16 +28,15 @@ class APIGroup(metaclass=abc.ABCMeta):
url = self.prefix + path
data = json.dumps(data)
headers['Content-Type'] = 'application/json'
async with aiohttp.ClientSession() as session:
async with session.request(
method,
url,
data=data,
params=params,
headers=headers,
**kwargs
) as resp:
return await resp.json()
return requests.request(
method,
url,
data=data,
params=params,
headers=headers,
**kwargs
)
def gen_rid(
self