Mediawiki: display an error when the article doesn't exist

This commit is contained in:
nemunaire 2014-09-19 07:59:11 +02:00
parent 880b2950d3
commit 8b819f097d

View File

@ -23,7 +23,10 @@ def get_raw_page(site, term, ssl=False):
data = json.loads(raw.read().decode())
for k in data["query"]["pages"]:
return data["query"]["pages"][k]["revisions"][0]["*"]
try:
return data["query"]["pages"][k]["revisions"][0]["*"]
except:
raise IRCException("article not found")
def get_unwikitextified(site, wikitext, ssl=False):
# Built IRL