问题
I'm working on a project which use the mediawiki API and I have this error :
error code=readapidenied info:'You need read permission to use this module.'
INFOS: Could not retrieve Mediawiki Version via API - will assume Mediawiki 1.27 or before you might want to set the Version actively if you are on 1.28 and have the api blocked for non-logged in users
This is my code :
Mediawiki wiki=new Mediawiki(site);
Login login=wiki.login(login,password); //error
wiki.edit(title, content , summary);
wiki.logout();
I know that I have Mediawiki 1.32.1 I tried a lot of variables for the login but I have the same error...
Can you help me to fix this error ? Thanks
回答1:
I just add
Mediawiki wiki=new Mediawiki(site);
wiki.setVersion("Mediawiki 1.28"); //New
Login login=wiki.login(login,password);
And don't forget to use a bot ! https://www.mediawiki.org/wiki/API:Login
来源:https://stackoverflow.com/questions/57146687/how-to-fix-readapidenied-error-on-mediawiki-api-in-java