Check if a MediaWiki page exists (Python)
Posted
by compie
on Stack Overflow
See other posts from Stack Overflow
or by compie
Published on 2010-03-13T19:59:31Z
Indexed on
2010/03/13
20:05 UTC
Read the original article
Hit count: 219
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?
© Stack Overflow or respective owner