Skip to content
Snippets Groups Projects
Commit 5e1c25b3 authored by Mathieu Loiseau's avatar Mathieu Loiseau
Browse files

mimetype OK server

parent 8188756b
No related branches found
No related tags found
No related merge requests found
...@@ -22,10 +22,21 @@ def search(wiktlang, wordlang, word): ...@@ -22,10 +22,21 @@ def search(wiktlang, wordlang, word):
if w.fetch(word) > 0: if w.fetch(word) > 0:
resp = w.__str__() resp = w.__str__()
status = 200 status = 200
mimetype='application/json'
else: else:
resp = f"{word} is unknown" resp = f"""<!doctype html>
<html>
<head>
<title>Error</title>
</head>
<body>
<h1>{word}</h1>
<p>{word} is unknown in “{wordlang}” in {wiktlang}.wiktionary.org.</p>
</body>
</html>"""
status = 404 status = 404
return Response(resp, status=status) mimetype='text/html'
return Response(resp, status=status, mimetype=mimetype)
if __name__ == "__main__": if __name__ == "__main__":
app.run(host=config.host, port=config.port, debug=config.debugging) app.run(host=config.host, port=config.port, debug=config.debugging)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment