Skip to content

Commit 225ce90

Browse files
author
endbro
authored
Merge pull request #1 from endbro/FIX-01
FIX-01: http 500 err, base img, requirements
2 parents 95053d8 + a5ba87b commit 225ce90

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3-alpine
1+
FROM python:3.9-alpine3.15
22
LABEL author="Endre Brønnum"
33
LABEL author.email="endre.bronnum@sesam.io"
44

service/requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
xmltodict==0.12.0
2-
requests==2.10.0
3-
Flask==2.0.1
2+
requests==2.27.1
3+
Flask==2.1.1
44
PyYAML==5.1

service/service.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import yaml
55

66
from xml.parsers.expat import ExpatError
7-
from flask import Flask, request, Response, jsonify
7+
from flask import Flask, abort, request, Response, jsonify
88
import os
99
import requests
1010

@@ -140,7 +140,7 @@ def xml_string_to_json():
140140
- xml attributes will be prefixed by "@" in the json data
141141
- accepts entities with non-existing XML string
142142
"""
143-
143+
144144
if(not request.is_json):
145145
return "Request body was not JSON", 400
146146

@@ -159,7 +159,8 @@ def emit_entities():
159159
# Sesam packs entities in an array before firing off a request and expects an array back. 
160160
yield '['
161161
first = True
162-
for item in request_payload:
162+
for item in request_payload:
163+
currentItem = item["_id"]
163164
if not first:
164165
yield ','
165166
else:
@@ -189,7 +190,8 @@ def emit_entities():
189190
yield ']'
190191

191192
except Exception as ex:
192-
logger.error(f"Exiting with error: {ex}")
193+
logger.error(f"Exiting with error: {ex} - suspected entity = {currentItem}")
194+
abort(500)
193195

194196
return Response(response=emit_entities(), mimetype='application/json')
195197

0 commit comments

Comments
 (0)