Open matkoniecz opened 3 years ago
@matkoniecz great idea. I'll address it in next release
It seem we can pass a config with overwriten config.API_URL
while initialization to interact with other Mediawiki instance?
Indeed. I found here because I need a generalizing mediawiki client. Please implement this or at least rename the project
@GHolk yes, you can overwrite the config.API_URL
and it should work if the site support the localization.
@GHolk @ManuelSchneid3r can you please provide me the example of sites you want to use the client for so I can perform the testing of the code changes?
Maybe Arch Linux wiki
I found mediawiki's bot tutorial provide a powerful module Pywikibot, thought I had not really used both of these modules.
I intended to use this module in Fandom and a Taiwanese ACG wiki (both in chinese), but I do not think it is convenient for you to test your code there.
Please DM me if you really want to and/or need helps.
Python v3.11 MediaWikiAPI v1.2
This seems to be close:
>>> import mediawikiapi
>>> explain_xkcd_wiki = mediawikiapi.MediaWikiAPI(config=mediawikiapi.Config(mediawiki_url="https://www.explainxkcd.com/wiki/api.php"))
>>> explain_page = explain_xkcd_wiki.page('2715')
>>> explain_page.title
'2715: Pando'
However, not every bit works:
>>> explain_page.summary
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/rhodges/anaconda3/envs/hero/lib/python3.11/site-packages/mediawikiapi/wikipediapage.py", line 309, in summary
self._summary: str = request["query"]["pages"][self.pageid]["extract"]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
KeyError: 'extract'
There are also many other Mediawiki installs and sites except Wikipedia, with the same API.
It would be nice to have access to them.