jenkins-bot has submitted this change and it was merged.
Change subject: api.py: do not call self.update_limit() twice ......................................................................
api.py: do not call self.update_limit() twice
Change-Id: I0c4a0990ad79743eb57a39287bfa4973ca070a93 --- M pywikibot/data/api.py 1 file changed, 5 insertions(+), 2 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py index d40cb3c..a574935 100644 --- a/pywikibot/data/api.py +++ b/pywikibot/data/api.py @@ -516,6 +516,7 @@ kwargs["indexpageids"] = "" # always ask for list of pageids self.request = Request(**kwargs) self.prefix = None + self.api_limit = None self.update_limit() # sets self.prefix if self.api_limit is not None and "generator" in kwargs: self.prefix = "g" + self.prefix @@ -582,12 +583,15 @@
""" limit = int(value) + # don't update if limit is greater than maximum allowed by API - self.update_limit() if self.api_limit is None: self.query_limit = limit else: self.query_limit = min(self.api_limit, limit) + pywikibot.debug(u"%s: Set query_limit to %i." + % (self.__class__.__name__, self.query_limit), + _logger)
def set_maximum_items(self, value): """Set the maximum number of items to be retrieved from the wiki. @@ -606,7 +610,6 @@ def update_limit(self): """Set query limit for self.module based on api response"""
- self.api_limit = None for mod in self.module.split('|'): for param in self._modules[mod].get("parameters", []): if param["name"] == "limit":
pywikibot-commits@lists.wikimedia.org