Handle most cases of cookie and image cache loading errors

This commit is contained in:
DevilXD committed 2023-06-03 23:03:52 +02:00
1 parent 5b8b6c7fdd
commit 2d1dfe007c
2 files changed
+23 -9

No files matched your search

+7 -2
View File
@@ -657,8 +657,13 @@ class Twitch:
chrome_agent = ClientType.WEB.USER_AGENT
# load in cookies
cookie_jar = aiohttp.CookieJar()
if COOKIES_PATH.exists():
cookie_jar.load(COOKIES_PATH)
try:
if COOKIES_PATH.exists():
cookie_jar.load(COOKIES_PATH)
except Exception:
# if loading in the cookies file ends up in an error, just ignore it
# clear the jar, just in case
cookie_jar.clear()
# create session, limited to 50 connections at maximum
connector = aiohttp.TCPConnector(limit=50)
self._session = aiohttp.ClientSession(