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:
1 parent
71a0e8c1d6
commit
5b22ed1c5d
12 files changed
+430
-25
No files matched your search
@@ -33,6 +33,10 @@ class ClientProvider:
|
||||
credentials = getattr(self.store.get().bilibili, self.role)
|
||||
key = (credentials.mid, credentials.cookie, credentials.csrf)
|
||||
if self._client is None or key != self._key:
|
||||
if self._client is not None:
|
||||
close = getattr(self._client, "close", None)
|
||||
if callable(close):
|
||||
close()
|
||||
self._client = self.factory(credentials)
|
||||
self._key = key
|
||||
return self._client
|
||||
Reference in new issue
Block a user