mobixconsulting commited on
Commit
9cd6077
1 Parent(s): a6847dd

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +5 -6
main.py CHANGED
@@ -6,8 +6,7 @@ import json
6
  app = FastAPI()
7
 
8
  class EatcHeadersResponse(BaseModel):
9
- eatc_code: str
10
- eatc_match_asignation_rule: str
11
 
12
  @app.get("/eatc-headers", response_model=EatcHeadersResponse)
13
  async def get_eatc_headers(eatc_code: str = Query(..., description="EATC code to retrieve headers for")):
@@ -16,10 +15,10 @@ async def get_eatc_headers(eatc_code: str = Query(..., description="EATC code to
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
- return {
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
  else:
24
  return {"error": "Invalid response from API"}
25
  else:
 
6
  app = FastAPI()
7
 
8
  class EatcHeadersResponse(BaseModel):
9
+ report: str
 
10
 
11
  @app.get("/eatc-headers", response_model=EatcHeadersResponse)
12
  async def get_eatc_headers(eatc_code: str = Query(..., description="EATC code to retrieve headers for")):
 
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"
19
+ report += f'"eatc_code":"{response_json["res"][0]["eatc-code"]}"\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: