Xqt has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/359653 )
Change subject: [bugfix] Re-enable xml for WikiStats with py2 ...................................................................... [bugfix] Re-enable xml for WikiStats with py2 Bug: T165830 Change-Id: I5a5864f617960328d003455f21c8b4b8b0c43ca6 --- M pywikibot/data/wikistats.py M tests/wikistats_tests.py 2 files changed, 9 insertions(+), 6 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/53/359653/1 diff --git a/pywikibot/data/wikistats.py b/pywikibot/data/wikistats.py index 7402944..f5dca8e 100644 --- a/pywikibot/data/wikistats.py +++ b/pywikibot/data/wikistats.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """Objects representing WikiStats API.""" # -# (C) Pywikibot team, 2014-2016 +# (C) Pywikibot team, 2014-2017 # # Distributed under the terms of the MIT license. from __future__ import absolute_import, unicode_literals @@ -104,7 +104,11 @@ @type format: 'xml' or 'csv'. @rtype: bytes """ - URL = self.url + '/api.php?action=dump&table=%s&format=%s' + if format == 'xml': + path = '/{format}/{table}.{format}' + else: + path = '/api.php?action=dump&table={table}&format={format}' + URL = self.url + path if table not in self.ALL_KEYS: pywikibot.warning('WikiStats unknown table %s' % table) @@ -112,7 +116,7 @@ if table in self.FAMILY_MAPPING: table = self.FAMILY_MAPPING[table] - r = http.fetch(URL % (table, format)) + r = http.fetch(URL.format(table=table, format=format)) return r.raw def raw_cached(self, table, format): @@ -185,7 +189,8 @@ site = {} for field in row.findall('field'): - site[field.get('name')] = unicode(field.text) + name = unicode(field.get('name')) + site[name] = unicode(field.text) data.append(site) diff --git a/tests/wikistats_tests.py b/tests/wikistats_tests.py index c373ae3..61b80ef 100644 --- a/tests/wikistats_tests.py +++ b/tests/wikistats_tests.py @@ -15,8 +15,6 @@ from tests.aspects import unittest, TestCase -@unittest.skip('Wikistats at https://wikistats.wmflabs.org/ ' - 'appears to be broken. See T165830.') class WikiStatsTestCase(TestCase): """Test WikiStats dump.""" -- To view, visit https://gerrit.wikimedia.org/r/359653 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5a5864f617960328d003455f21c8b4b8b0c43ca6 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: Xqt <i...@gno.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits