jenkins-bot merged this change.

View Change

Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
Use the parameters argument of PropertyGenerator

This is to avoid pywikibot.data.api.Request._warn_kwargs warning.

Change-Id: I3123d8492ef2521ff1811f3be68cbd427dfed673
---
M pywikibot/site.py
M tests/api_tests.py
2 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/pywikibot/site.py b/pywikibot/site.py
index 050d8be..88f48eb 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -3489,9 +3489,10 @@
# don't request patrol
query = api.PropertyGenerator(
'info',
- titles='Dummy page',
- intoken=valid_tokens - {'patrol'},
- site=self)
+ site=self,
+ parameters={
+ 'intoken': valid_tokens - {'patrol'},
+ 'titles': 'Dummy page'})
query.request._warning_handler = warn_handler

for item in query:
diff --git a/tests/api_tests.py b/tests/api_tests.py
index aabfcb8..041af5f 100644
--- a/tests/api_tests.py
+++ b/tests/api_tests.py
@@ -672,7 +672,7 @@
for l in links]
gen = api.PropertyGenerator(site=self.site,
prop="info",
- titles='|'.join(titles))
+ parameters={'titles': '|'.join(titles)})

count = 0
for pagedata in gen:
@@ -690,7 +690,7 @@
for l in links]
gen = api.PropertyGenerator(site=self.site,
prop="revisions",
- titles='|'.join(titles))
+ parameters={'titles': '|'.join(titles)})
gen.set_maximum_items(-1) # suppress use of "rvlimit" parameter

count = 0
@@ -710,7 +710,7 @@
for l in links]
gen = api.PropertyGenerator(site=self.site,
prop="revisions|coordinates",
- titles='|'.join(titles))
+ parameters={'titles': '|'.join(titles)})
gen.set_maximum_items(-1) # suppress use of "rvlimit" parameter

count = 0
@@ -729,10 +729,12 @@
links = list(self.site.pagelinks(mainpage, total=30))
titles = [l.title(withSection=False)
for l in links]
- gen = api.PropertyGenerator(site=self.site,
- prop="revisions|info|categoryinfo|langlinks|templates",
- rvprop="ids|flags|timestamp|user|comment|content",
- titles='|'.join(titles))
+ gen = api.PropertyGenerator(
+ site=self.site,
+ prop='revisions|info|categoryinfo|langlinks|templates',
+ parameters={
+ 'rvprop': 'ids|flags|timestamp|user|comment|content',
+ 'titles': '|'.join(titles)})

# An APIError is raised if set_maximum_items is not called.
gen.set_maximum_items(-1) # suppress use of "rvlimit" parameter
@@ -755,9 +757,9 @@
links = list(self.site.pagelinks(mainpage, total=30))
titles = [l.title(withSection=False)
for l in links]
- gen = api.PropertyGenerator(site=self.site,
- prop="info|categoryinfo|langlinks|templates",
- titles='|'.join(titles))
+ gen = api.PropertyGenerator(
+ site=self.site, prop='info|categoryinfo|langlinks|templates',
+ parameters={'titles': '|'.join(titles)})
# Force the generator into continuation mode
gen.set_query_increment(5)

@@ -776,9 +778,9 @@
links = list(mainpage.backlinks(total=300))
titles = [l.title(withSection=False)
for l in links]
- gen = api.PropertyGenerator(site=self.site,
- prop="info|categoryinfo|langlinks|templates",
- titles='|'.join(titles))
+ gen = api.PropertyGenerator(
+ site=self.site, prop='info|categoryinfo|langlinks|templates',
+ parameters={'titles': '|'.join(titles)})
# Force the generator into continuation mode
gen.set_query_increment(50)

To view, visit change 423592. To unsubscribe, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I3123d8492ef2521ff1811f3be68cbd427dfed673
Gerrit-Change-Number: 423592
Gerrit-PatchSet: 2
Gerrit-Owner: Dalba <dalba.wiki@gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb@gmail.com>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444@gmail.com>
Gerrit-Reviewer: jenkins-bot <>