From e91262be62163f79257a75788b850667e512d7cd Mon Sep 17 00:00:00 2001 From: Olivier Da Rocha Date: Wed, 13 Nov 2019 17:20:22 +0100 Subject: [PATCH] [browser/exceptions] BrowserTooManyRequests: Check whether the next_try is None after the date check If we check if next_try is None first, then we will set the next_try to a default datetime that will be overriden by the next check on date. --- weboob/browser/exceptions.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/weboob/browser/exceptions.py b/weboob/browser/exceptions.py index a97fbaf091..e134d29ae3 100644 --- a/weboob/browser/exceptions.py +++ b/weboob/browser/exceptions.py @@ -57,12 +57,12 @@ class BrowserTooManyRequests(BrowserUnavailable): def __init__(self, message='', next_try=None): super(BrowserTooManyRequests, self).__init__(message) + if isinstance(next_try, datetime.date) and not isinstance(next_try, datetime.datetime): + next_try = datetime.datetime.combine(next_try, datetime.datetime.min.time()) + if next_try is None: next_try = BrowserTooManyRequests.NEXT_24H - if isinstance(next_try, datetime.date): - next_try = datetime.datetime.combine(next_try, datetime.datetime.min.time()) - self.next_try = next_try def __str__(self): -- GitLab