-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpar.py
More file actions
36 lines (32 loc) · 947 Bytes
/
par.py
File metadata and controls
36 lines (32 loc) · 947 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
26
27
28
29
30
31
32
33
34
35
36
from glob import glob
import os
from telegram import ParseMode
from requests import Request, Session
from requests.exceptions import ConnectionError, Timeout, TooManyRedirects
from db import db, get_or_create_user, subscribe_user, unsubscribe_user
from utils import main_keyboard
import settings
import json
import pprint
import dpath.util as dp # pip install dpath
def get_help_dict():
url = 'https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest'
parameters = {
'start': '1',
'limit':'30',
'convert':'USD'
}
headers = {
'Accepts': 'application/json',
'X-CMC_PRO_API_KEY': settings.COINMARKETCAP
}
session = Session()
session.headers.update(headers)
response = session.get(url, params=parameters)
coins = json.loads(response.text)['data']
ab = []
for n in coins:
ab.append(n['name']+' '+n['symbol'])
# ab = "".join(ab)
print(ab)
return ab