mobixconsulting commited on
Commit
a6847dd
1 Parent(s): b89e59a

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +6 -3
main.py CHANGED
@@ -7,6 +7,7 @@ app = FastAPI()
7
 
8
  class EatcHeadersResponse(BaseModel):
9
  eatc_code: 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,9 +16,11 @@ 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
- return {"eatc_code": response_json["res"][0]["eatc-code"]}
 
 
 
19
  else:
20
  return {"error": "Invalid response from API"}
21
  else:
22
- return {"error": "API returned error status code"}
23
-
 
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
  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:
26
+ return {"error": "API returned error status code"}