diff --git a/qt/aqt/main.py b/qt/aqt/main.py index 744f53041..b770902c6 100644 --- a/qt/aqt/main.py +++ b/qt/aqt/main.py @@ -1370,6 +1370,7 @@ title="{}" {}>{}""".format( True, parent=self, ) + self.progress.timer(12 * 60 * 1000, self.refresh_certs, False, parent=self) def onRefreshTimer(self) -> None: if self.state == "deckBrowser": @@ -1385,6 +1386,15 @@ title="{}" {}>{}""".format( if elap > minutes * 60: self.maybe_auto_sync_media() + def refresh_certs(self) -> None: + # The requests library copies the certs into a temporary folder on startup, + # and chokes when the file is later missing due to temp file cleaners. + # Work around the issue by accessing them once every 12 hours. + import certifi + + with open(certifi.where(), "rb") as f: + f.read() + # Backups ########################################################################## diff --git a/qt/mypy.ini b/qt/mypy.ini index cff9c7490..53c847e43 100644 --- a/qt/mypy.ini +++ b/qt/mypy.ini @@ -63,6 +63,8 @@ ignore_missing_imports = True ignore_missing_imports = True [mypy-stringcase] ignore_missing_imports = True +[mypy-certifi] +ignore_missing_imports = True [mypy-aqt.forms.*] disallow_untyped_defs = false