Return the trace if an exception occurred

This commit is contained in:
Yoshi Askharoun
2021-05-31 16:04:19 -05:00
parent 44488c86de
commit a6b4b3bfcb
+17 -13
View File
@@ -16,21 +16,25 @@ musicbrainzngs.set_useragent("Zune", "4.8", "https://github.com/yoshiask/PyZuneC
@app.route(f"/v2/<string:locale>/account/signin", methods=['POST'])
def account_signin(locale: str):
print(request.data)
signinReq: Document = xml.parseString(request.data.decode('utf-8'))
tunerInfo: Element = signinReq.firstChild
idElem: Element = tunerInfo.getElementsByTagName("ID")[0]
nameElem: Element = tunerInfo.getElementsByTagName("Name")[0]
typeElem: Element = tunerInfo.getElementsByTagName("Type")[0]
versionElem: Element = tunerInfo.getElementsByTagName("Version")[0]
id: str = idElem.firstChild.data
try:
print(request.data)
signinReq: Document = xml.parseString(request.data.decode('utf-8'))
tunerInfo: Element = signinReq.firstChild
idElem: Element = tunerInfo.getElementsByTagName("ID")[0]
nameElem: Element = tunerInfo.getElementsByTagName("Name")[0]
typeElem: Element = tunerInfo.getElementsByTagName("Type")[0]
versionElem: Element = tunerInfo.getElementsByTagName("Version")[0]
id: str = idElem.firstChild.data
doc: Document = minidom.Document()
feed: Element = create_feed(doc, "album_name", "album_id", request.endpoint)
doc: Document = minidom.Document()
feed: Element = create_feed(doc, "album_name", "album_id", request.endpoint)
# doc.appendChild(feed)
xml_str = doc.toprettyxml(indent="\t")
return Response(xml_str, mimetype=MIME_XML)
# doc.appendChild(feed)
xml_str = doc.toprettyxml(indent="\t")
return Response(xml_str, mimetype=MIME_XML)
except Exception as e:
import traceback
return Response(traceback.format_exc(), status=500, mimetype="text/plain")
if __name__ == "__main__":