jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/637866 )
Change subject: [fix] Don't show a FutureWarning when using WikiStats.get()
......................................................................
[fix] Don't show a FutureWarning when using WikiStats.get()
All WikiStats methods fetch, raw_cached, xml, csv are deprecated.
Do not call them with get() method.
Change-Id: Ia4867199961f694400c3537e33e1c8dd13d8b3ea
---
M pywikibot/data/wikistats.py
1 file changed, 8 insertions(+), 2 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/data/wikistats.py b/pywikibot/data/wikistats.py
index 979df92..53757ab 100644
--- a/pywikibot/data/wikistats.py
+++ b/pywikibot/data/wikistats.py
@@ -146,8 +146,14 @@
if table in self._data:
return self._data[table]
- raw = self.raw_cached(table)
- f = StringIO(raw.decode('utf8'))
+ if table not in self.ALL_KEYS:
+ pywikibot.warning('WikiStats unknown table ' + table)
+
+ table = self.FAMILY_MAPPING.get(table, table)
+ path = '/api.php?action=dump&table={table}&format=csv'
+ url = self.url + path
+ r = http.fetch(url.format(table=table))
+ f = StringIO(r.text)
reader = DictReader(f)
data = list(reader)
self._data[table] = data
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/637866
To unsubscribe, or for help writing mail filters, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ia4867199961f694400c3537e33e1c8dd13d8b3ea
Gerrit-Change-Number: 637866
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
_______________________________________________
Pywikibot-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits