diff --git a/rowers/tests/testdata/testdata.tcx.gz b/rowers/tests/testdata/testdata.tcx.gz index a9f938ac..90fc40ea 100644 Binary files a/rowers/tests/testdata/testdata.tcx.gz and b/rowers/tests/testdata/testdata.tcx.gz differ diff --git a/rowers/views/apiviews.py b/rowers/views/apiviews.py index e0cf44db..278c6fda 100644 --- a/rowers/views/apiviews.py +++ b/rowers/views/apiviews.py @@ -466,6 +466,14 @@ def strokedata_tcx(request): except Exception as e: # pragma: no cover dologging('apilog.log','TCX') dologging('apilog.log',e) + if request.data: + tcxdata = request.data + tcxfilename = 'media/{code}.tcx'.format(code=uuid4().hex[:16]) + xml_string = ET.tostring(tcxdata, encoding='utf-8', method='xml').decode('utf-8') + + with open(tcxfilename, 'w', encoding='utf-8') as xml_file: + xml_file.write(xml_string) + _ = myqueue(queuehigh, handle_sendemail_unrecognized, tcxfilename, "tcx parser") return HttpResponseNotAllowed("Could not parse TCX data") @@ -520,6 +528,7 @@ def strokedata_tcx(request): except Exception as e: # pragma: no cover dologging('apilog.log','TCX API endpoint') dologging('apilog.log',e) + _ = myqueue(queuehigh, handle_sendemail_unrecognized, tcxfilename, "tcx parser") return HttpResponse(status=500)