Spaces:
Running

andervier commited on
Commit
297b450
·
1 Parent(s): 96f9f5f

fix: use consistent camelCase field names in BCV response

Browse files
Files changed (1) hide show
  1. main.py +7 -7
main.py CHANGED
@@ -93,18 +93,18 @@ async def fetch_bcv() -> dict:
93
  soup = BeautifulSoup(response.text, "lxml")
94
 
95
  currency_ids = {
96
- "usd": "dolar",
97
- "eur": "euro",
98
- "cny": "yuan",
99
- "try": "lira",
100
- "rub": "rublo",
101
  }
102
 
103
  rates = {}
104
- for code, div_id in currency_ids.items():
105
  div = soup.find(id=div_id)
106
  tag = div.find("strong") if div else None
107
- rates[f"bcv{code.upper()}"] = _parse_bcv_rate(tag.text) if tag else None
108
 
109
  if all(v is None for v in rates.values()):
110
  raise HTTPException(status_code=503, detail="No se pudo obtener las tasas BCV")
 
93
  soup = BeautifulSoup(response.text, "lxml")
94
 
95
  currency_ids = {
96
+ "Usd": "dolar",
97
+ "Eur": "euro",
98
+ "Cny": "yuan",
99
+ "Try": "lira",
100
+ "Rub": "rublo",
101
  }
102
 
103
  rates = {}
104
+ for suffix, div_id in currency_ids.items():
105
  div = soup.find(id=div_id)
106
  tag = div.find("strong") if div else None
107
+ rates[f"bcv{suffix}"] = _parse_bcv_rate(tag.text) if tag else None
108
 
109
  if all(v is None for v in rates.values()):
110
  raise HTTPException(status_code=503, detail="No se pudo obtener las tasas BCV")