How to fix “readapidenied” error on mediawiki-api in Java

别说谁变了你拦得住时间么 提交于 2019-12-08 10:13:51

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!