We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 08a5ab2 + 6c8357f commit 3664dc8Copy full SHA for 3664dc8
currency converter/main.py
@@ -9,13 +9,15 @@
9
10
11
def getVal(cont1, cont2):
12
+ # Extract currency codes from user input (format assumed like "USD- United States Dollar")
13
cont1val = cont1.split("-")[1]
14
cont2val = cont2.split("-")[1]
15
url = f"https://free.currconv.com/api/v7/convert?q={cont1val}_{cont2val}&compact=ultra&apiKey=b43a653672c4a94c4c26"
16
r = httpx.get(url)
17
htmlContent = r.content
18
soup = BeautifulSoup(htmlContent, "html.parser")
19
try:
20
+ # Extract the numeric value from the response text
21
valCurr = float(soup.get_text().split(":")[1].removesuffix("}")) # {USD:70.00}
22
except Exception:
23
print("Server down.")
0 commit comments