jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/930190 )
Change subject: Add support for other types of diffs in site.compare() ......................................................................
Add support for other types of diffs in site.compare()
Change-Id: I96294a7162f6ea0775e250b9f73a12e0239c43a8 --- M pywikibot/site/_apisite.py 1 file changed, 18 insertions(+), 2 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/site/_apisite.py b/pywikibot/site/_apisite.py index 1d77118..0674085 100644 --- a/pywikibot/site/_apisite.py +++ b/pywikibot/site/_apisite.py @@ -2851,7 +2851,12 @@ self._property_names = [pn['propname'] for pn in ppngen] return self._property_names
- def compare(self, old: _CompType, diff: _CompType) -> str: + def compare( + self, + old: _CompType, + diff: _CompType, + difftype: str = 'table' + ) -> str: """ Corresponding method to the 'action=compare' API action.
@@ -2861,6 +2866,7 @@ Use pywikibot.diff's html_comparator() method to parse result. :param old: starting revision ID, title, Page, or Revision :param diff: ending revision ID, title, Page, or Revision + :param difftype: type of diff. One of 'table' or 'inline'. :return: Returns an HTML string of a diff between two revisions. """ # check old and diff types @@ -2885,7 +2891,8 @@
params = {'action': 'compare', f'from{old_t[0]}': old_t[1], - f'to{diff_t[0]}': diff_t[1]} + f'to{diff_t[0]}': diff_t[1], + 'difftype': difftype}
req = self.simple_request(**params) data = req.submit()