ot-test commited on
Commit
40dba98
·
1 Parent(s): 67612db

update upload function return data type

Browse files
Files changed (1) hide show
  1. app/main.py +3 -2
app/main.py CHANGED
@@ -49,6 +49,7 @@ class Protocol(BaseModel):
49
  name: str
50
  content: str
51
 
 
52
  @app.post("/protocol")
53
  def upload_protocol(protocol: Protocol):
54
  file_path = 'storage/' + protocol.name
@@ -59,9 +60,9 @@ def upload_protocol(protocol: Protocol):
59
  response = call_opentrons_simulate(file_path)
60
  print('response', response)
61
  if response["status"] == "success":
62
- return {"protocol_name": protocol.name, "run_log": response['run_log']}
63
  else:
64
- return {"error_message": response['error_message']}
65
  else:
66
  return {"error_message": "something wrong while saving a protocol"}
67
 
 
49
  name: str
50
  content: str
51
 
52
+
53
  @app.post("/protocol")
54
  def upload_protocol(protocol: Protocol):
55
  file_path = 'storage/' + protocol.name
 
60
  response = call_opentrons_simulate(file_path)
61
  print('response', response)
62
  if response["status"] == "success":
63
+ return {"protocol_name": protocol.name, "run_status": "success", "run_log": response['run_log']}
64
  else:
65
+ return {"protocol_name": protocol.name, "run_status": "failure", "error_message": response['error_message']}
66
  else:
67
  return {"error_message": "something wrong while saving a protocol"}
68