feat: add Mihomo API client with refresh polling
Implements MihomoClient wrapping Mihomo's REST API with provider refresh polling, config reload, and startup readiness check. Also fixes a Python 3.14 + respx 0.21.1 compatibility issue where the httpcore mocker passes bytes method to httpx.Request causing Method pattern matching to fail; resolved by switching respx DEFAULT_MOCKER to the httpx-level mocker. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,14 @@ import sys
|
||||
import os
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
|
||||
|
||||
import respx.mocks
|
||||
# Python 3.14 + httpx 0.28 compatibility: httpcore passes method as bytes,
|
||||
# but the httpcore mocker reconstructs httpx.Request with bytes method,
|
||||
# causing Method pattern comparison ('GET' == b'GET') to always fail.
|
||||
# Use the httpx-level mocker instead, which patches AsyncClient._transport_for_url
|
||||
# and avoids the bytes/str mismatch entirely.
|
||||
respx.mocks.DEFAULT_MOCKER = "httpx"
|
||||
|
||||
import pytest_asyncio
|
||||
from sqlalchemy.ext.asyncio import create_async_engine, async_sessionmaker
|
||||
from models import Base
|
||||
|
||||
Reference in New Issue
Block a user