handling timeout when fetching old history

This commit is contained in:
Vincent Paredes 2015-07-23 17:59:44 +02:00 committed by Romain Bignon
commit e8ab487681

View file

@ -21,6 +21,7 @@
import datetime import datetime
from dateutil.relativedelta import relativedelta from dateutil.relativedelta import relativedelta
from weboob.exceptions import BrowserHTTPError
from weboob.deprecated.browser import Browser, BrowserIncorrectPassword from weboob.deprecated.browser import Browser, BrowserIncorrectPassword
from .pages import LoginPage, AccountPage, UselessPage, HomePage, ProHistoryPage, PartHistoryPage, HistoryDetailsPage, ErrorPage from .pages import LoginPage, AccountPage, UselessPage, HomePage, ProHistoryPage, PartHistoryPage, HistoryDetailsPage, ErrorPage
@ -128,12 +129,15 @@ class Paypal(Browser):
return iter([]) return iter([])
assert step_max <= 365*2 # PayPal limitations as of 2014-06-16 assert step_max <= 365*2 # PayPal limitations as of 2014-06-16
for i in self.smart_fetch(beginning=self.BEGINNING, try:
end=datetime.date.today(), for i in self.smart_fetch(beginning=self.BEGINNING,
step_min=step_min, end=datetime.date.today(),
step_max=step_max, step_min=step_min,
fetch_fn=fetch_fn): step_max=step_max,
yield i fetch_fn=fetch_fn):
yield i
except BrowserHTTPError:
self.logger.warning("Paypal timeout")
def smart_fetch(self, beginning, end, step_min, step_max, fetch_fn): def smart_fetch(self, beginning, end, step_min, step_max, fetch_fn):
""" """