Spaces:
Sleeping
Sleeping
made changes
Browse files
app.py
CHANGED
@@ -16,18 +16,29 @@ def live_crypto_price(cryptocurrencies:list)-> str: #it's import to specify the
|
|
16 |
cryptocurrencies: list containing the cryptocurrencies of which prices are required (e.g., ['bitcoin', 'cardano'])
|
17 |
"""
|
18 |
results = []
|
19 |
-
try:
|
20 |
-
|
21 |
-
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
vs_currencies: "inr"}
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
|
32 |
@tool
|
33 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
16 |
cryptocurrencies: list containing the cryptocurrencies of which prices are required (e.g., ['bitcoin', 'cardano'])
|
17 |
"""
|
18 |
results = []
|
19 |
+
# try:
|
20 |
+
# url = "https://api.coingecko.com/api/v3/simple/price"
|
21 |
+
# cryptos = ','.join(c for c in cryptocurrencies)
|
22 |
+
# parms = {ids: cryptos,
|
23 |
+
# vs_currencies: "inr"}
|
24 |
+
# response = requests.get(url, params=params)
|
25 |
+
# data = response.json()
|
26 |
+
# for keys, values in data.items():
|
27 |
+
# results.append(f"the price of {keys} is {values['inr']}.")
|
28 |
+
# return ''.join(result for result in results)
|
29 |
+
# except:
|
30 |
+
# return f"Error fetching prices for {cryptos}."
|
31 |
+
url = "https://api.coingecko.com/api/v3/simple/price"
|
32 |
+
cryptos = ','.join(c for c in cryptocurrencies)
|
33 |
+
parms = {ids: cryptos,
|
34 |
vs_currencies: "inr"}
|
35 |
+
response = requests.get(url, params=params)
|
36 |
+
data = response.json()
|
37 |
+
for keys, values in data.items():
|
38 |
+
results.append(f"the price of {keys} is {values['inr']}.")
|
39 |
+
return ''.join(result for result in results)
|
40 |
+
|
41 |
+
|
42 |
|
43 |
@tool
|
44 |
def get_current_time_in_timezone(timezone: str) -> str:
|