Commit 1bceadb7 authored by Vincent Ardisson's avatar Vincent Ardisson Committed by Vincent A

[trainline] start listing documents by passing today's month

We slide 3 months window to paginate documents but if there are no
documents on the first page, we couldn't take 3 months in the past as
the date wasn't initialized. Now, take current month instead.
parent ff1a31c6
......@@ -18,6 +18,7 @@
# along with this weboob module. If not, see <>.
from time import sleep
from datetime import date
from dateutil.relativedelta import relativedelta
......@@ -57,12 +58,12 @@ class TrainlineBrowser(LoginBrowser):
def iter_documents(self, subscription):
min_date = None
min_date =
docs = {}
i = 0
while i < 10:
params = {'date': min_date.strftime('%Y-%m-01')} if min_date else None
params = {'date': min_date.strftime('%Y-%m-01')}
# date params has a very silly behavior
# * day seems to be useless, (but we have to put it anyway)
# * server return last 3 months from date (including month we give)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment