diff options
author | Kyomotoi <[email protected]> | 2021-10-24 16:47:29 +0800 |
---|---|---|
committer | Kyomotoi <[email protected]> | 2021-10-24 16:47:29 +0800 |
commit | 16838e0d83c8dd3f1be1e6ec5fb1cecd9b319d8a (patch) | |
tree | 77630910cac9cc38396cabe3dcc11e2d856a6c2f /ATRI/utils | |
parent | d789b1ae77f4415dab062c4af516e303dc447ddc (diff) | |
download | ATRI-16838e0d83c8dd3f1be1e6ec5fb1cecd9b319d8a.tar.gz ATRI-16838e0d83c8dd3f1be1e6ec5fb1cecd9b319d8a.tar.bz2 ATRI-16838e0d83c8dd3f1be1e6ec5fb1cecd9b319d8a.zip |
🔖 更新版本:YHN-001-A04
新增:
- nsfw检测(主动/被动) 又名 涩图嗅探
- 可选代理
修复:
- plugin/chat 在 nb2-a14+ 版本 finish 内为空时会报错
其他:
- 对定时任务进行中文命名
Diffstat (limited to 'ATRI/utils')
-rw-r--r-- | ATRI/utils/request.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/ATRI/utils/request.py b/ATRI/utils/request.py index 8dec9c7..2cfce85 100644 --- a/ATRI/utils/request.py +++ b/ATRI/utils/request.py @@ -1,11 +1,17 @@ import httpx +from ATRI.config import BotSelfConfig + + +proxy = BotSelfConfig.proxy +if not proxy: + proxy = dict() async def get(url: str, **kwargs): - async with httpx.AsyncClient() as client: + async with httpx.AsyncClient(proxies=proxy) as client: return await client.get(url, **kwargs) async def post(url: str, **kwargs): - async with httpx.AsyncClient() as client: + async with httpx.AsyncClient(proxies=proxy) as client: return await client.post(url, **kwargs) |