From 4669b2c1c9a1654db340d02ff16c9f88be661d9f Mon Sep 17 00:00:00 2001 From: John Smith Date: Sun, 28 Mar 2021 17:47:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0HTTP=E8=AF=B7=E6=B1=82?= =?UTF-8?q?=E8=B6=85=E6=97=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- blivedm.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/blivedm.py b/blivedm.py index e217886..98dc068 100644 --- a/blivedm.py +++ b/blivedm.py @@ -361,7 +361,7 @@ class BLiveClient: self._future = None if session is None: - self._session = aiohttp.ClientSession(loop=self._loop) + self._session = aiohttp.ClientSession(loop=self._loop, timeout=aiohttp.ClientTimeout(total=10)) self._own_session = True else: self._session = session @@ -469,7 +469,7 @@ class BLiveClient: return False if not self._parse_room_init(data['data']): return False - except aiohttp.ClientConnectionError: + except (aiohttp.ClientConnectionError, asyncio.TimeoutError): logger.exception('room %d init_room失败:', self._tmp_room_id) return False return True @@ -495,7 +495,7 @@ class BLiveClient: return False if not self._parse_danmaku_server_conf(data['data']): return False - except aiohttp.ClientConnectionError: + except (aiohttp.ClientConnectionError, asyncio.TimeoutError): logger.exception('room %d getConf失败:', self._room_id) return False return True