You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I can login, and then immediatly get page content, save page content , etc. But : I 'm using scripts that run for a long time , scanning all wiki pages, and then modifying page contents : sometimes I'm getting readapidenied error again on my private wiki. For example when trying to save a page :
Traceback (most recent call last):
File "build/bdist.linux-x86_64/egg/mwclient/page.py", line 216, in save
File "build/bdist.linux-x86_64/egg/mwclient/page.py", line 121, in get_token
File "build/bdist.linux-x86_64/egg/mwclient/client.py", line 514, in get_token
File "build/bdist.linux-x86_64/egg/mwclient/client.py", line 239, in post
File "build/bdist.linux-x86_64/egg/mwclient/client.py", line 282, in api
File "build/bdist.linux-x86_64/egg/mwclient/client.py", line 306, in handle_api_result
mwclient.errors.APIError: (u'readapidenied', u'You need read permission to use this module', u'See http://l203psj002.mousquetaires.com/api.php for API usage')
([…] The same happens when making other API calls.)
OK, I guess the following is happening, and may happen with MW < 1.27 too :
open a session with mwclient on a private wiki
if the session is destroyed on the server and mwclient is making an api call, mwclient calls site.get_token() (which calls action=query&meta=tokens)
on a private wiki this raises a readapidenied error as the only api call that can be made when unauthenticated is for getting a logintoken (action=query&meta=tokens&type=login)
I guess we could catch readapidenied in handle_api_result, re-login and retry the request. Just have to be a bit careful to avoid ending up in endless loops :)
The text was updated successfully, but these errors were encountered:
I'm having a problem related to this, which I describe in openzim/wp1#69. Although I have attempted to catch the mwclient.errors.AssertUserFailedError and login again, that doesn't seem to be working. Any help is greatly appreciated.
From #155 by @Ubibene:
([…] The same happens when making other API calls.)
I guess we could catch
readapidenied
inhandle_api_result
, re-login and retry the request. Just have to be a bit careful to avoid ending up in endless loops :)The text was updated successfully, but these errors were encountered: