feat(http): use httpx with pooled connections and browser headers

Add httpx and route Bilibili and Telegram requests through pooled clients with keepalive and explicit timeouts. Align Bilibili headers with data/raw-request.txt: Chrome 155 UA, sec-ch-ua, space.bilibili.com origin, folder-specific referer, and priority header. Close replaced clients when credentials change. Add transport contract tests and live read-only validation for nav, folder sync, WBI search, and Telegram getUpdates.
This commit is contained in:
kairee committed 2026-10-31 22:28:32 +08:00
1 parent 71a0e8c1d6
commit 5b22ed1c5d
12 files changed
+430 -25

No files matched your search

+4
View File
@@ -99,6 +99,10 @@ def test_fav_ids_parse_and_anonymous_header():
assert "media_id=3700023351" in call["url"]
assert "SESSDATA" not in call["headers"]["cookie"]
assert "buvid3=device" in call["headers"]["cookie"]
assert call["headers"]["origin"] == "https://space.bilibili.com"
assert call["headers"]["priority"] == "u=1, i"
assert "Chrome/155.0.0.0" in call["headers"]["user-agent"]
assert "fid=3700023351" in call["headers"]["referer"]
def test_anonymous_failure_falls_back_to_full_cookie():