mobixconsulting commited on
Commit
4c40977
1 Parent(s): 0956b4f

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +7 -4
main.py CHANGED
@@ -2,6 +2,7 @@ from fastapi import FastAPI, Query
2
  from pydantic import BaseModel
3
  import requests
4
  import json
 
5
 
6
  app = FastAPI()
7
 
@@ -15,10 +16,12 @@ async def get_eatc_headers(eatc_code: str = Query(..., description="EATC code to
15
  if response.status_code == 200:
16
  response_json = json.loads(response.text)
17
  if len(response_json) >= 2 and "res" in response_json and response_json["res"]:
18
- report = f"REPORTE DE AUDITORIA PARA = {response_json['res'][0]['eatc-code']}\n\n"
19
- report += f'"eatc_code": "{response_json["res"][0]["eatc-code"]}"\n\n'
20
- report += f'"eatc_match_asignation_rule": "{response_json["res"][0].get("eatc_match_asignation_rule", "")}"'
21
- return {"report": report}
 
 
22
  else:
23
  return {"error": "Invalid response from API"}
24
  else:
 
2
  from pydantic import BaseModel
3
  import requests
4
  import json
5
+ import pandas as pd
6
 
7
  app = FastAPI()
8
 
 
16
  if response.status_code == 200:
17
  response_json = json.loads(response.text)
18
  if len(response_json) >= 2 and "res" in response_json and response_json["res"]:
19
+ data = {
20
+ "eatc_code": response_json["res"][0]["eatc-code"],
21
+ "eatc_match_asignation_rule": response_json["res"][0].get("eatc_match_asignation_rule", "")
22
+ }
23
+ df = pd.DataFrame([data])
24
+ return {"report": df.to_string(index=False)}
25
  else:
26
  return {"error": "Invalid response from API"}
27
  else: