我无法访问我的媒体 wiki 站点的编辑令牌。使用以下代码,我应该能够使用 simpleMediWiki 站点登录,然后请求编辑令牌,最后进行编辑。不幸的是,我收到一个错误,即“编辑”参数是一个无法识别的参数:
{'error': {'info': "Unrecognized value for parameter 'action': token", 'code': 'unknown_action'}}
这是我的代码:
from simplemediawiki import MediaWiki
wiki = MediaWiki('http://domain/api.php')
#the following logs me in
loginData = wiki.call({'action':'login', 'lgname':'myUserName','lgpassword':'myPassword'})
#The following is a resubmission of the login token
personalLoginData = wiki.call({'action':'login', 'lgname':'myUserName','lgpassword':'myPassword','lgtoken': loginData['login']['token']})
#the following is THE TROUBLESOME REQUEST FOR AN EDIT TOKEN
editTokenDict = wiki.call({'action':'tokens','type':'edit'})
#the following is an edit
results = wiki.call({'action':'edit','title':"ArticleTitle",'text':"This is the page",'tokens':editTokenDict['login']['token']})