From 42627865b19f0a81a05e3ddd2b457f7959fc83e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Michael=20O=2E=20Hegg=C3=B8?= <danmichaelo@gmail.com> Date: Mon, 27 Oct 2014 00:07:55 +0100 Subject: [PATCH] [#66] Use 'simplifed' continuation if available --- mwclient/listing.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/mwclient/listing.py b/mwclient/listing.py index 02a80d6..d6bc1e8 100644 --- a/mwclient/listing.py +++ b/mwclient/listing.py @@ -17,6 +17,8 @@ class List(object): if limit is None: limit = site.api_limit self.args[self.prefix + 'limit'] = str(limit) + if 'continue' not in self.args: + self.args['continue'] = '' self.count = 0 self.max_items = max_items @@ -62,8 +64,14 @@ class List(object): raise StopIteration self.set_iter(data) - if self.list_name in data.get('query-continue', ()): + if data.get('continue'): + # New style continuation, added in MediaWiki 1.21 + self.args.update(data['continue']) + + elif self.list_name in data.get('query-continue', ()): + # Old style continuation self.args.update(data['query-continue'][self.list_name]) + else: self.last = True -- GitLab