File size: 504 Bytes
92390df
 
101b311
 
 
92390df
 
 
 
 
 
 
 
101b311
92390df
 
 
 
101b311
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from flask import Flask, render_template
import requests

app = Flask(__name__)

def get_crypto_prices():
    url = "https://api.coingecko.com/api/v3/simple/price"
    params = {
        'ids': 'bitcoin,ethereum,ripple',
        'vs_currencies': 'usd'
    }
    response = requests.get(url, params=params)
    return response.json()

@app.route('/')
def index():
    prices = get_crypto_prices()
    return render_template('index.html', prices=prices)

if __name__ == '__main__':
    app.run(debug=True)