#12990 wiki, cannot edit via pyhton script, mwclient.errors.APIError: ('internal_api_error_Error)
Closed: Fixed with Explanation by psklenar. Opened by psklenar.

Describe what you would like us to do:

1, firefox: I am logged in
https://accounts.stg.fedoraproject.org/user/psklenar/

2, I can edit and save wiki pages in stg environment via firefox
3, I cannot change it via python script

python -c 'import wikitcms.wiki;wikitcms.wiki.Wiki("stg.fedoraproject.org").login()'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
    import wikitcms.wiki;wikitcms.wiki.Wiki("stg.fedoraproject.org").login()
                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/lib/python3.14/site-packages/wikitcms/wiki.py", line 338, in login
    self.site_init()
    ~~~~~~~~~~~~~~^^
  File "/usr/lib/python3.14/site-packages/mwclient/client.py", line 201, in site_init
    info = self.get('query', meta='userinfo', uiprop='groups|rights')
  File "/usr/lib/python3.14/site-packages/mwclient/client.py", line 300, in get
    return self.api(action, 'GET', *args, **kwargs)
           ~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.14/site-packages/mwclient/client.py", line 361, in api
    if self.handle_api_result(info, sleeper=sleeper):
       ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.14/site-packages/mwclient/client.py", line 418, in handle_api_result
    raise errors.APIError(info['error']['code'],
                          info['error']['info'], info['error']['*'])
mwclient.errors.APIError: ('internal_api_error_Error', '[aUE9rI3EyArjAKCMx100VwAAAIc] Exception caught: Call to a member function getId() on null', 'Error at /usr/share/mediawiki/extensions/OpenIDConnectAPI/OpenIDConnectAPI.class.php(24)\nfrom /usr/share/mediawiki/extensions/OpenIDConnectAPI/OpenIDConnectAPI.class.php(24)\n#0 /usr/share/mediawiki/includes/HookContainer/HookContainer.php(159): OpenIDConnectAPI::beforeAPIMain()\n#1 /usr/share/mediawiki/includes/HookContainer/HookRunner.php(704): MediaWiki\\HookContainer\\HookContainer->run()\n#2 /usr/share/mediawiki/includes/api/ApiEntryPoint.php(139): MediaWiki\\HookContainer\\HookRunner->onApiBeforeMain()\n#3 /usr/share/mediawiki/includes/MediaWikiEntryPoint.php(200): MediaWiki\\Api\\ApiEntryPoint->execute()\n#4 /usr/share/mediawiki/api.php(44): MediaWiki\\MediaWikiEntryPoint->run()\n#5 {main}')

4, the same for relval --test (stg environment)
relval report-results --test --testtype Cloud -m Rawhide -y x86_64 -s 'QA:Testcase_base_startup'
t

5, no stg, it works fine:
python -c 'import wikitcms.wiki;wikitcms.wiki.Wiki("fedoraproject.org").login()'


When do you need this to be done by?

EOY 2025

What to do? can I request bot for my automation?


Is this happening only on staging?

Metadata Update from @zlopez:
- Issue priority set to: Waiting on Assignee (was: Needs Review)
- Issue tagged with: Needs investigation, low-gain

@zlopez , yes only on staging

we do have a bot account for automation, the account called 'coconut'. We should set your scripts up to use that for 'production' use, as personal tokens expire. but we should still fix this so you can test stuff using your personal account.

FYI I am able to use my account with stage. I was probably at some limits.

Closing this one.

Metadata Update from @psklenar:
- Issue close_status updated to: Fixed with Explanation
- Issue status updated to: Closed (was: Open)

Metadata