Page MenuHomePhabricator

Add FlaggedRevs support to Pywikibot (Outreachy 31)
Open, Needs TriagePublic

Description

Add FlaggedRevs support to Pywikibot. Current idea is to add following functions to Pywikibot and cover all FlaggedRevs API functions. Please leave comments about the function names and places where they would be implemented.

Older tickets: T57081

Generators

  1. unreviewedpages() generator
  1. oldreviewedpages() generator
  1. configuredpages() generator

Site functions

  1. _apisite.review_revision() -- T408389
  1. _apisite.stabilize()
  1. _apisite.flagconfig()

Page functions

  1. _basepage.stable_revision()
    • return latest stable revision
    • make it work similarly than page.latest_revision()
  1. _basepage.stable_revision_id()
    • return latest stable revision id
    • make it work similarly than page.latest_revision_id()
  1. _basepage.flagged_state()
  1. _basepage.pending_changes_only_from_single_user()
    • Return true if the page has pending changes only from single user

11 _basepage.review_revision()

  • wrapper to site.review_revision()

12 _basepage.stabilize()

  • wrapper to site.stabilize()

Event Timeline

Zache renamed this task from Add FlaggedRews support to Pywikibot (Outreachy round 31) to Add FlaggedRews support to Pywikibot (Outreachy 31).Oct 29 2025, 6:47 PM
matej_suchanek renamed this task from Add FlaggedRews support to Pywikibot (Outreachy 31) to Add FlaggedRevs support to Pywikibot (Outreachy 31).Oct 29 2025, 9:10 PM
matej_suchanek updated the task description. (Show Details)
  1. _apisite.flagconfig()

I think this API endpoint should be deprecated:

  • It’s designed to contain much more data than what’s actually possible in 2025: it could report an arbitrary number of tags, but no more than one tag is possible anymore. It also reports tier1 with a constant value of 1, which isn’t useful.
  • It doesn’t include some very useful data, in particular the flaggable namespaces. https://hu.wikipedia.org/wiki/Szerkesztő:BinBot/huwiki/flaggedrevs.py (see T57081#8747890) solves this by hardcoding the list of namespaces, which is clearly not scalable.
  • A minor issue is that it’s a separate module rather than a submodule of query – the latter would clearly indicate that it’s read-only, and it would allow bundling it with other requests (as far as I remember, Pywikibot also supports such bundling).

For these reasons, I think action=flagconfig should be deprecated, and another module, say action=query&meta=flaggedrevs (or even action=query&meta=siteinfo&siprop=flaggedrevs) should be introduced, which returns at least the following data:

  • Whether the wiki is in protection mode (“English-style”) or not (“German-style”). Currently this is implicit from the fact that wikis in protection mode return zero tags, other wikis return one tag.
  • The name of the (only) tag; currently returned in name of the first tag if not in protection mode, but it would be needed in protection mode as well (it’s used as a parameter name when reviewing).
  • The maximum level of the (only) tag; currently returned in levels of the first tag if not in protection mode. It probably doesn’t make much sense to have more than one level in protection mode, but as far as I understand the code, it’s possible, so it would also make sense regardless of the protection mode setting.
  • Flagged namespaces, currently not returned at all.

I already have some drafts for this, I just haven’t got to finish and upload them. If others agree, and so the module is about to be deprecated and completely reorganized, I’m not sure if it’s worth adding the old one to Pywikibot

  1. _apisite.flagconfig()

I think this API endpoint should be deprecated:

For these reasons, I think action=flagconfig should be deprecated, and another module, say action=query&meta=flaggedrevs (or even action=query&meta=siteinfo&siprop=flaggedrevs) should be introduced, which returns at least the following data:

Other data which would be useful

  • protection levels ( ie. wgFlaggedRevsRestrictionLevels values ) which is need for API:stabilize to set which user groups can automatically review revision
  • is wiki stable by default or latest by default: (ie. wgFlaggedRevsOverride value)

The name of the (only) tag; currently returned in name of the first tag if not in protection mode, but it would be needed in protection mode as well (it’s used as a parameter name when reviewing).

It would be nice if tag name requirement would be removed from reviewing API too so it would be just flag=3 instead of flag_accuracy=3. In pywikibot side i think that code can handle this.

I already have some drafts for this, I just haven’t got to finish and upload them. If others agree, and so the module is about to be deprecated and completely reorganized, I’m not sure if it’s worth adding the old one to Pywikibot.

I agree.