feat: 内容函数全局开关支持

This commit is contained in:
RockChinQ
2023-07-29 16:28:18 +08:00
parent ae6994e241
commit 8c69b8a1d9
6 changed files with 48 additions and 163 deletions
+10 -3
View File
@@ -16,12 +16,16 @@ class RequestBase:
"""处理代理问题"""
ret: dict = {}
exception: Exception = None
async def awrapper(**kwargs):
nonlocal ret
nonlocal ret, exception
ret = await self.req_func(**kwargs)
return ret
try:
ret = await self.req_func(**kwargs)
return ret
except Exception as e:
exception = e
loop = asyncio.new_event_loop()
@@ -33,6 +37,9 @@ class RequestBase:
thr.start()
thr.join()
if exception is not None:
raise exception
return ret
def __iter__(self):