From 0c400fb4d5bbbb6ca431775f285c104e3b88836e Mon Sep 17 00:00:00 2001 From: Scott Wallace Date: Wed, 31 May 2023 11:53:09 +0100 Subject: [PATCH] Fix bad image downloads --- maubot.yaml | 2 +- tmdb/tmdb_api.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/maubot.yaml b/maubot.yaml index d77d700..3837f10 100644 --- a/maubot.yaml +++ b/maubot.yaml @@ -1,6 +1,6 @@ maubot: 0.1.0 id: lomion.tmdb -version: 1.3.0+scott-1fb64b9 +version: 1.3.0+scott license: AGPL 3.0 modules: - tmdb diff --git a/tmdb/tmdb_api.py b/tmdb/tmdb_api.py index 29e1483..e01fb3a 100644 --- a/tmdb/tmdb_api.py +++ b/tmdb/tmdb_api.py @@ -76,8 +76,11 @@ class TmdbApiSingle(TmdbApi): async def query_image_binary(self): if self.poster_url: - async with self.session.get(self.poster_url) as resp: - self.poster_binary = await resp.read() + try: + async with self.session.get(self.poster_url) as resp: + self.poster_binary = await resp.read() + except aiohttp.client_exceptions.ClientConnectorError: + self.poster_binary = None else: self.poster_binary = None