Currently there is no FlaggedRevs review API support in Pywikibot so it would be useful to add it there and not implement it to PendingChangesBot code.
Proposed Solution:
Add new function review() to pywikibot/site/ _apisite.py with following parameters. Add also unit tests for the new function.
- revid: The revision ID for which to set the flags
- summary: Comment for the review (optional, default "")
- flag_accuracy: Set the flag named "accuracy" to the specified value; (replace "accuracy" with the flag name to set another flag)
- unapprove : If set, revision will be unapproved rather than approved (optional, default: None)
Notes
- Test if flag-parameter is mandatory? If it is not then leave it out as unsupported parameter.
- If it is optional, document it being optional also to mediawiki.org: Extension:FlaggedRev page.
- Pywikibot uses summary in function call parameters, FlaggedRews API uses comment as parameter name
- use Pywikibots simple_request() for calling mediawiki API (see _apisite:protect() as example)
Review user right
You can ask to be added to reviewer user group in fiwiki for developing by commenting on this phabricator ticket
Test pages
Do not review/unreview other pages than these for testing
- https://fi.wikipedia.org/wiki/Merkityt_versiot_-kokeilu/Testisivu_1
- https://fi.wikipedia.org/wiki/Merkityt_versiot_-kokeilu/Testisivu_2
- https://fi.wikipedia.org/wiki/Merkityt_versiot_-kokeilu/Testisivu_3
- https://fi.wikipedia.org/wiki/Merkityt_versiot_-kokeilu/Testisivu_4
Documentation:
Examples:
- huwiki: flaggedrevs.py (see review_id() function)
- _apisite:protect()
- tests/site_tests.py | test_protect()
- PendingChangesBot: review() -- Note: this is old and it doesn't use simple_request
Code Review Requirements:
For the patch to pass Pywikibot code review, please ensure:
- Follow Gerrit guidelines:
- Manual:Pywikibot/Gerrit - For_developers
- Gerrit: Commit message guidelines
- See also: T407059 (Pywikibot contribution howto documentation)
- Code quality:
- Patch must follow the Pywikibot style guide
- No flake8 errors or warnings
- Commit message must follow style guidelines
- Testing:
- Added error handling must include unit tests
- Tests should verify proper error detection and messaging for OAuth/BotPassword scenarios