tokiospg commited on
Commit
dbcffb4
verified
1 Parent(s): cca20f5

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -150,7 +150,12 @@ def activar_organizacion_imap():
150
  num_lic = "".join(re.findall(r'\d+', str(st.session_state.cg.get('numero_licitacion', ''))))
151
  datos = {"username": st.session_state.username, "licitacion_activa": num_lic, "contexto_items": items_json}
152
  res = requests.post(f"{API_URL_BASE}/organizar-correos", data=datos, headers=API_HEADERS)
153
- if res.status_code == 200: return True, res.json().get("mensaje", "Organizaci贸n completada.")
 
 
 
 
 
154
  else: return False, f"Error del servidor: {res.text}"
155
  except Exception as e: return False, str(e)
156
 
 
150
  num_lic = "".join(re.findall(r'\d+', str(st.session_state.cg.get('numero_licitacion', ''))))
151
  datos = {"username": st.session_state.username, "licitacion_activa": num_lic, "contexto_items": items_json}
152
  res = requests.post(f"{API_URL_BASE}/organizar-correos", data=datos, headers=API_HEADERS)
153
+ if res.status_code == 200:
154
+ json_res = res.json()
155
+ if json_res.get("status") == "success":
156
+ return True, json_res.get("mensaje", "Organizaci贸n completada.")
157
+ else:
158
+ return False, json_res.get("mensaje", "Error desconocido.")
159
  else: return False, f"Error del servidor: {res.text}"
160
  except Exception as e: return False, str(e)
161