import json import os import requests from models import Asset apikey = os.environ.get('API_KEY') headers = { 'X-CMC_PRO_API_KEY': apikey, 'Accepts': 'application/json' } params = { 'start': '1', 'limit': '5', 'convert': 'USD' } def getTokePrice(symbol): url = 'https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest' json = requests.get(url, params=params, headers=headers).json() coins = json['data']
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter