Hi everyone.
I'm trying to code a wikipedia bot, building the framework myself. I
want to understand how to interpret the results of a request to the
Edit MediaWiki API. So far my code does this :
Interpret HTTP status code.
if it's 503, sleep then try again
if it's 504, sleep then try again
if it's not 200, abort giving an error code
Test for an API Error
if it's maxlag, sleep then try again
if it's editconflict, restart the whole test-edit sequence
if it's success, return success
abort, giving an error code
1. Are there any common replies that I am not accounting for with the
above code?
2. How do I best test for an API Error? Should I search the header
for "MediaWiki-API-Error:" and use the rest of the string as the code?
Or should I test the body? I'm working in XML.
3. Similarly, how do I best test for success?
TIA,
Richard