-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig_api.py
More file actions
25 lines (20 loc) · 769 Bytes
/
config_api.py
File metadata and controls
25 lines (20 loc) · 769 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import requests
def esmoneda(cripto):
return cripto in monedas
monedas_list = []
#COINMARKET_API_KEY = "fea42815-ebda-4b39-9a22-3e057beda67d"
headers = {
'Accepts': 'application/json',
'X-CMC_PRO_API_KEY': 'fea42815-ebda-4b39-9a22-3e057beda67d'
}
data = requests.get(
"https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest", headers=headers).json()
for cripto in data["data"]:
monedas_list.append(cripto["symbol"])
monedas = tuple(monedas_list)
moneda = input("Ingrese el Nombre de la Moneda a verificar:->>")
while not esmoneda(moneda):
print("ERROR: MONEDA INVALIDA")
moneda = input("Ingrese el Nombre de la Moneda a verificar:->>")
else:
print("La moneda,", moneda, "es valida porque existe en COIMNMARKETCAP.COM")