mirror of
https://github.com/EstrellaXD/Auto_Bangumi.git
synced 2026-11-05 06:58:12 +08:00
- ab-plugin new 与示例插件的 requires-python 改为 >=3.14,与 SDK 0.6.0 一致 - 示例插件 ntfy-notifier / webhook-on-event 改用 httpx2 - openai / anthropic / google-genai 下限改为实际需要的大版本 - 插件 MCP 工具的 input_schema 无效时计入熔断 - 复制 RSS 链接在 HTTP 部署下回退到 execCommand(useClipboard legacy) - CI 步骤名、PLAYWRIGHT_VERSION、README 徽章与 e2e 指南改为 Python 3.14 / Playwright 1.64.1
22 lines
614 B
Python
22 lines
614 B
Python
import httpx2
|
|
from ntfy_notifier import NtfyNotifier
|
|
|
|
from ab_sdk.notify import NotifierSettings
|
|
from ab_sdk.testing import NotifierContract, create_plugin
|
|
|
|
|
|
def channel(status: int):
|
|
plugin, _ = create_plugin(NtfyNotifier, {"topic": "ab"})
|
|
plugin.client_factory = lambda: httpx2.AsyncClient( # type: ignore[method-assign]
|
|
transport=httpx2.MockTransport(lambda request: httpx2.Response(status))
|
|
)
|
|
return plugin.channel()(NotifierSettings())
|
|
|
|
|
|
class TestChannel(NotifierContract):
|
|
def create(self):
|
|
return channel(200)
|
|
|
|
def create_failing(self):
|
|
return channel(403)
|