zhenxun_bot/zhenxun/utils/decorator/retry.py
HibiKier 4ed1791b30
🐛 修复添加插件依赖更新 (#1837)
* 🐛 修复添加插件依赖更新

* 🔧 修改插件依赖安装命令为使用poetry运行pip

* 🐛 修复群组入群与退群提示

* 🐛 修复群组踢出用户提醒

* 🎨 代码优化

* 🎨 群欢迎迁移优化

* 🩹 精确webui调用统计

* 🚨 auto fix by pre-commit hooks

* 🐛 修复测试

* 🎨 fix pre-commit.ci

* 🎨  fix pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-02-03 21:23:14 +08:00

17 lines
485 B
Python

from httpx import ConnectError, HTTPStatusError, TimeoutException
from tenacity import retry, retry_if_exception_type, stop_after_attempt, wait_fixed
class Retry:
@staticmethod
def api():
"""接口调用重试"""
return retry(
reraise=True,
stop=stop_after_attempt(3),
wait=wait_fixed(1),
retry=retry_if_exception_type(
(TimeoutException, ConnectError, HTTPStatusError)
),
)