diff --git a/weboob/tools/browser/browser.py b/weboob/tools/browser/browser.py index 7d9c55a8..11c3209b 100644 --- a/weboob/tools/browser/browser.py +++ b/weboob/tools/browser/browser.py @@ -406,7 +406,7 @@ class StandardBrowser(mechanize.Browser): if certhash != hash: raise ssl.SSLError() - + class BaseBrowser(StandardBrowser): """ Base browser class to navigate on a website. @@ -441,6 +441,10 @@ class BaseBrowser(StandardBrowser): PROTOCOL = 'http' PAGES = {} + # SHA-256 hash of server certificate. If set, it will automatically check it, + # and raise a SSLError exception if it doesn't match. + CERTHASH = None + # ------ Abstract methods -------------------------------------- def home(self): @@ -479,6 +483,9 @@ class BaseBrowser(StandardBrowser): self.username = username self.password = password + if self.CERTHASH is not None and self.DOMAIN is not None: + self.lowsslcheck(self.DOMAIN, self.CERTHASH) + if self.password and get_home: try: self.home()