title: Flask Api to parse xml post requests returning errors
body: <p>I am writing a python-flask api to parse and manipulate xml using xml to dict. Below is my initial code:</p>
  
  <pre><code>from flask import Flask, jsonify, abort, make_response, request, 
  render_template
  import sys, sqlite3, requests, datetime, time, re, json, optparse
  import xmltodict
  import helpers
  import platform
  app = Flask(__name__)
  
  start = int(round(time.time()))
  print("api running")
  
  @app.route("/", methods=['GET', 'POST'])
  def parse_xml():
      content_dict = xmltodict.parse(request.data)
      return content_dict
  
  if __name__ == '__main__':
      print("Starting python app")
      app.run(host='0.0.0.0', port=8080, debug=False)
  </code></pre>
  
  <p>The following curl request: <code>curl -H "Authorization: Bearer Token" -X POST -d '&lt;xml&gt;&lt;From&gt;Jack&lt;/From&gt;&lt;Body&gt;Hello, it worked!&lt;/Body&gt;&lt;/xml&gt;' url</code></p>
  
  <p>Returns the errors:</p>
  
  <blockquote>
    <p>2018-04-18T13:33:38.831293275Z [2018-04-18 13:33:38,830] ERROR in app:
    Exception on / [POST] 2018-04-18T13:33:38.831324305Z Traceback (most
    recent call last): 2018-04-18T13:33:38.831331225Z   File
    "/usr/lib/python2.7/site-packages/flask/app.py", line 1982, in
    wsgi_app 2018-04-18T13:33:38.831336961Z     response =
    self.full_dispatch_request() 2018-04-18T13:33:38.83134283Z   File
    "/usr/lib/python2.7/site-packages/flask/app.py", line 1614, in
    full_dispatch_request 2018-04-18T13:33:38.831352063Z     rv =
    self.handle_user_exception(e) 2018-04-18T13:33:38.831357531Z   File
    "/usr/lib/python2.7/site-packages/flask/app.py", line 1517, in
    handle_user_exception 2018-04-18T13:33:38.83136302Z<br>
    reraise(exc_type, exc_value, tb) 2018-04-18T13:33:38.831367481Z   File
    "/usr/lib/python2.7/site-packages/flask/app.py", line 1612, in
    full_dispatch_request 2018-04-18T13:33:38.831372038Z     rv =
    self.dispatch_request() 2018-04-18T13:33:38.831377673Z   File
    "/usr/lib/python2.7/site-packages/flask/app.py", line 1598, in
    dispatch_request 2018-04-18T13:33:38.831385927Z     return
    self.view_functionsrule.endpoint
    2018-04-18T13:33:38.831391913Z   File "/src/simpleapp.py", line 14, in
    parse_xml 2018-04-18T13:33:38.831396571Z     content_dict =
    xmltodict.parse(request.data) 2018-04-18T13:33:38.831401027Z   File
    "/usr/lib/python2.7/site-packages/xmltodict.py", line 330, in parse
    2018-04-18T13:33:38.831407166Z     parser.Parse(xml_input, True)
    2018-04-18T13:33:38.831412259Z ExpatError: no element found: line 1,
    column 0 2018-04-18T13:33:38.831705887Z 100.96.2.171 - - [18/Apr/2018
    13:33:38] "POST / HTTP/1.1" 500 -</p>
  </blockquote>
  
  <p>Any help would be appreciated, thank you.</p>