支持茶服多个api地址的故障转移 (#301)

*  RequestError 新增 status_code 参数

*  新增支持故障转移的请求方法

*  支持茶服多个api地址的故障转移
This commit is contained in:
呵呵です
2024-04-30 01:52:41 +08:00
committed by GitHub
parent d037cf6d44
commit ec392ee384
4 changed files with 81 additions and 25 deletions

View File

@@ -18,6 +18,10 @@ class NeedCatchError(TetrisStatsError):
class RequestError(NeedCatchError):
"""请求错误"""
def __init__(self, message: str = '', *, status_code: int | None = None):
super().__init__(message)
self.status_code = status_code
class MessageFormatError(NeedCatchError):
"""用户发送的消息格式不正确"""