You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
536 B
Python

4 years ago
from requests import get as r_get
from flask import current_app
4 years ago
def get_market_data(coin_name='monero'):
data = {
'localization': False,
'tickers': False,
'market_data': True,
'community_data': False,
'developer_data': False,
'sparkline': False
}
headers = {'accept': 'application/json'}
url = f'https://api.coingecko.com/api/v3/coins/{coin_name}'
4 years ago
current_app.logger.info(f'GET - {url}')
r = r_get(url, timeout=8, headers=headers, data=data)
4 years ago
return r.json()