Page MenuHomePhabricator

"pywikibot.exceptions.Error: API write action attempted without userinfo" despite being logged in
Closed, InvalidPublic


When submitting an API call through to do action=wbsetlabel on Commons, the API request is never sent, and pywikibot displays an error message "pywikibot.exceptions.Error: API write action attempted without userinfo".

This happens even if the request immediately follows a login (using an account bot password) via There does not seem to be a way to pass the userinfo into the request function.

Example code is at - the task I am trying to code up copies the description from an image to a Structured Data on Commons caption.

Event Timeline

Restricted Application added subscribers: pywikibot-bugs-list, Aklapper. · View Herald TranscriptJan 30 2019, 8:47 PM
Xqt triaged this task as High priority.Jan 31 2019, 12:27 AM

Just guessing here, but is there some magic code in the framework that "knows" to do special things when the wiki is Wikidata but doesn't know to do it on Commons?

Mike_Peel closed this task as Resolved.Feb 4 2019, 8:30 PM
Mike_Peel claimed this task.

Aah, I found the problem. I was using the LoginManager class in pywikibot to log in, but I actually needed to use the site class to log in. So, it now works! This edit was by the code that's now on bitbucket:

(It also didn't work on Wikidata ... I should have double-checked that before, sorry!)

JJMC89 changed the task status from Resolved to Invalid.Feb 5 2019, 2:15 AM