From ac33283e5a9dfcd3de75552bf92b4c0e4a53d317 Mon Sep 17 00:00:00 2001
From: Adam Williamson <awilliam@redhat.com>
Date: Wed, 20 Apr 2016 15:15:20 -0700
Subject: [PATCH] add 'end' arg for PageList

this is sometimes useful; for instance I have a use case for
getting all pages in a given namespace that are alphabetically
between two specific points (because their names are in a
predictable format that involves alphabetically-sorted dates).
'end' is added as the last kwarg to avoid breaking any current
uses that rely on the kwarg ordering (thanks dan for pointing
that out).
---
 mwclient/listing.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/mwclient/listing.py b/mwclient/listing.py
index 07ffd17..b47e03f 100644
--- a/mwclient/listing.py
+++ b/mwclient/listing.py
@@ -181,7 +181,7 @@ class Category(mwclient.page.Page, GeneratorList):
 
 class PageList(GeneratorList):
 
-    def __init__(self, site, prefix=None, start=None, namespace=0, redirects='all'):
+    def __init__(self, site, prefix=None, start=None, namespace=0, redirects='all', end=None):
         self.namespace = namespace
 
         kwargs = {}
@@ -189,6 +189,8 @@ class PageList(GeneratorList):
             kwargs['gapprefix'] = prefix
         if start:
             kwargs['gapfrom'] = start
+        if end:
+            kwargs['gapto'] = end
 
         GeneratorList.__init__(self, site, 'allpages', 'ap',
                                gapnamespace=text_type(namespace), gapfilterredir=redirects, **kwargs)
-- 
GitLab