https://bugzilla.wikimedia.org/show_bug.cgi?id=66619
--- Comment #8 from Thiemo Mättig thiemo.maettig@wikimedia.de --- I don't know exactly what's happening here but it seems I have a very similar patch in review at https://gerrit.wikimedia.org/r/#/c/138660/
Please note that result["error"]["messages"] is not an array but an object (at least that's what I see in the JavaScript code my patch touches). I wonder why Python complains. Accessing the elements via ["0"] should work.