Check if a MediaWiki page exists (Python)
- by compie
I'm working on a Python script that transforms this:
foo
bar
Into this:
[[Component foo]]
[[bar]]
The script checks (per input line) if the page "Component foo" exists. If it exists then a link to that page is created, if it doesn't exist then a direct link is created.
The problem is that I need a quick & cheap way to check if a lot of wiki pages exist.I don't want to (try to) download all the 'Component' pages.
I already figured out a fast way to do this by hand: Edit a new wiki page. paste all the 'component' links into the page, press preview, and then save the resulting preview HTML page. The resulting HTML file contains a different link for existing pages than for non-existing pages.
So to rephrase my question: How can I save a mediawiki preview page in Python?