Refactor MediaWiki API client to WikiLoginClient#143
Conversation
- Import WikiLoginClient from cats_maker repository. - Refactor ALL_APIS to use WikiLoginClient for authentication. - Implement post_continue method in WikiLoginClient for API pagination. - Replace all legacy Login class usages with WikiLoginClient. - Replace post_params and post methods with client_request across the codebase. - Fix bugs and regressions identified during code review, including duplicate API calls and forced POST requests. - Update tests to maintain compatibility with the new client.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
- Import the latest WikiLoginClient from the cats_maker repository. - Implement post_continue method for MediaWiki API pagination. - Refactor ALL_APIS and all bot/page modules to use WikiLoginClient. - Replace legacy post_params/post methods with client_request. - Fix regressions in API wrappers and ensure correct GET/POST method mapping. - Update test suite to maintain compatibility.
- Integrated the latest WikiLoginClient from cats_maker.
- Re-applied custom improvements:
- Added post_continue for pagination.
- Improved session initialization and authentication logic.
- Handled missing settings by providing defaults for cookies_dir.
- Updated ALL_APIS class and all repository dependencies to use the new client.
- Verified with full test suite.
This PR refactors the MediaWiki API client by replacing the legacy
Loginclass with the more robustWikiLoginClient.Key changes:
WikiLoginClientwhich usesmwclientinternally and provides better session management, cookie persistence, and automatic retries for CSRF and maxlag.post_continuetoWikiLoginClientto handle MediaWiki API continuation queries, maintaining compatibility with the previous implementation's behavior.LogintoWikiLoginClientthroughout the repository.ALL_APISclass to utilize the new client.post_paramsandpostcalls withclient_request.movemethod where the same API request was mistakenly sent three times.Typeparameter in legacy wrappers is correctly mapped to themethodparameter inclient_request, allowing both GET and POST requests as intended.All tests passed locally.
PR created automatically by Jules for task 877470545044727384 started by @MrIbrahem