(Cloned from T57068#602805)
pywikibot api.py has a hard-coded list of 'write' actions, which cause it to assert the user is logged
This should be converted to a detection algorithm (using API action paraminfo)
(Cloned from T57068#602805)
pywikibot api.py has a hard-coded list of 'write' actions, which cause it to assert the user is logged
This should be converted to a detection algorithm (using API action paraminfo)
Subject | Repo | Branch | Lines +/- | |
---|---|---|---|---|
[FEAT] Request: Dynamically determine write | pywikibot/core | master | +228 -86 |
Status | Subtype | Assigned | Task | ||
---|---|---|---|---|---|
Open | None | T78390 Load volatile information at run-time from the API (tracking) | |||
Open | None | T74207 detect write api actions |
Ideally, a persistent cache should be set up to remember the 'paraminfo' data.
For example, the "writerights" property would enable assertion, while "tokentype" would help guessing the required token type automatically.
E.g.:
https://www.mediawiki.org/w/api.php?action=paraminfo&modules=thank
We now have a per-site persistent cache - the ParamInfo class, in site._paraminfo.
As ParamInfo uses Request, a little dancing is needed soas to not cause cyclic recursion during bootstrap. One approach is for Request to hard-code that 'paraminfo' is not a write operation, so it doesnt ask ParamInfo if it is a write operation.
Regarding the dancing: ParamInfo explicitly says that it wants to use HTTP GET so that Request doesn't look into the ParamInfo whether paraminfo requires HTTP POST. So it could do it similarly.
In theory that is already possible, as the definition whether a request is writing is saved in the Request instance as a boolean which could be changed after creation of the Request and before submitting it.
Change 198485 had a related patch set uploaded (by XZise):
[FEAT] Request: Dynamically determine write
What about shipping a 'fake' JSON paraminfo for use with old MediaWikis?
That way we wouldn't have to maintain separate fallback techniques here and there, also for T78393, etc.
Replying to posts via Flow can be considered a write action but with the implementation of 3dcdc191 and fd9c7fd2 (via Pywikibot-Flow) -simulate won't block these writes.
@XZise: Hi! This task has been assigned to you a while ago. Could you maybe share an update? Do you still plan to work on this task?
If you do not plan to work on this task anymore: Please consider removing yourself as assignee (via Add Action... → Assign / Claim in the dropdown menu): That would allow others to work on this (in theory), as others won't think that someone is already working on this. Thanks! :)