Add xml endpoint

This commit is contained in:
John Sheehan
2014-03-12 14:53:46 -07:00
committed by Kevin McCarthy
parent b2cb8678f3
commit 64d10cba0e
2 changed files with 31 additions and 1 deletions
+7 -1
View File
@@ -45,7 +45,6 @@ tmpl_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'templates')
app = Flask(__name__, template_folder=tmpl_dir)
# -----------
# Middlewares
# -----------
@@ -535,5 +534,12 @@ def image():
return status_code(404)
@app.route("/xml")
def xml():
response = make_response(render_template("sample.xml"))
response.headers["Content-Type"] = "application/xml"
return response
if __name__ == '__main__':
app.run()
+24
View File
@@ -0,0 +1,24 @@
<?xml version='1.0' encoding='us-ascii'?>
<!-- A SAMPLE set of slides -->
<slideshow
title="Sample Slide Show"
date="Date of publication"
author="Yours Truly"
>
<!-- TITLE SLIDE -->
<slide type="all">
<title>Wake up to WonderWidgets!</title>
</slide>
<!-- OVERVIEW -->
<slide type="all">
<title>Overview</title>
<item>Why <em>WonderWidgets</em> are great</item>
<item/>
<item>Who <em>buys</em> WonderWidgets</item>
</slide>
</slideshow>