Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -15,9 +15,13 @@ def crypto_currency_price(coin_name:str)-> str:
|
|
| 15 |
coin_name: A string representing a name of the crypto currency coin whose price needs to be fetched.
|
| 16 |
"""
|
| 17 |
try:
|
| 18 |
-
endpoint = "https://api.coincap.io/v2/assets/"
|
|
|
|
| 19 |
response = requests.get(endpoint)
|
|
|
|
| 20 |
result = response.json()
|
|
|
|
|
|
|
| 21 |
if result and result.data:
|
| 22 |
return result.data.priceUsd
|
| 23 |
return "No price found"
|
|
|
|
| 15 |
coin_name: A string representing a name of the crypto currency coin whose price needs to be fetched.
|
| 16 |
"""
|
| 17 |
try:
|
| 18 |
+
endpoint = f"https://api.coincap.io/v2/assets/{coin_name}"
|
| 19 |
+
print(endpoint)
|
| 20 |
response = requests.get(endpoint)
|
| 21 |
+
print(response)
|
| 22 |
result = response.json()
|
| 23 |
+
print("result")
|
| 24 |
+
print(result)
|
| 25 |
if result and result.data:
|
| 26 |
return result.data.priceUsd
|
| 27 |
return "No price found"
|