更新
This commit is contained in:
@@ -737,7 +737,7 @@ class DouyinImHttpClient:
|
||||
pass
|
||||
return total
|
||||
|
||||
async def get_conversations(self) -> list[dict]:
|
||||
async def get_conversations(self, *, enrich_profiles: bool = True) -> list[dict]:
|
||||
"""拉取会话列表,返回标准化会话"""
|
||||
payloads = [
|
||||
{"cursor": 0, "count": 50, "inbox_type": 0},
|
||||
@@ -754,7 +754,12 @@ class DouyinImHttpClient:
|
||||
if data is None:
|
||||
data = await self._request("GET", "/v1/conversation/list", body)
|
||||
if data is None:
|
||||
continue
|
||||
# Payload variants only help with schema compatibility. They
|
||||
# cannot repair a network outage, so stop after POST + GET
|
||||
# both fail instead of occupying a scarce global slot for up
|
||||
# to four more full request timeouts.
|
||||
logger.warning("Conversation poll transport failed; skipping payload fallbacks")
|
||||
break
|
||||
|
||||
status_code = data.get("status_code") if isinstance(data, dict) else None
|
||||
error_text = ""
|
||||
@@ -814,6 +819,9 @@ class DouyinImHttpClient:
|
||||
enriched: list[dict] = []
|
||||
for item in conversations:
|
||||
conv = enrich_conversation_item(item, my_uid)
|
||||
if not enrich_profiles:
|
||||
enriched.append(conv)
|
||||
continue
|
||||
peer_uid = str(conv.get("peer_uid") or "")
|
||||
name = (conv.get("sender_name") or "").strip()
|
||||
avatar = str(conv.get("sender_avatar") or "").strip()
|
||||
|
||||
Reference in New Issue
Block a user