mirror of
https://github.com/Fluffy-Bean/Fluffys-website.git
synced 2024-12-28 02:06:05 +00:00
I will never push an API key to public repo
This commit is contained in:
parent
c32d7e3246
commit
d313845196
6
app.py
6
app.py
|
@ -2,10 +2,14 @@ from flask import Flask, render_template, redirect
|
||||||
from flask_compress import Compress
|
from flask_compress import Compress
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
import dotenv
|
||||||
from random import choice
|
from random import choice
|
||||||
import json
|
import json
|
||||||
|
|
||||||
|
|
||||||
|
LASTFM_API_KEY = dotenv.get_key('./.env', 'LASTFM')
|
||||||
|
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
Compress(app)
|
Compress(app)
|
||||||
|
|
||||||
|
@ -46,7 +50,7 @@ def about():
|
||||||
@app.route('/music')
|
@app.route('/music')
|
||||||
def music():
|
def music():
|
||||||
current_tracks = requests.get(
|
current_tracks = requests.get(
|
||||||
'http://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=Fluffy_Bean_&api_key=a6793a0176141e5cf7767c4cec1bda6f&limit=5&format=json')
|
f'http://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=Fluffy_Bean_&api_key={LASTFM_API_KEY}&limit=5&format=json')
|
||||||
current_tracks = json.loads(current_tracks.text)
|
current_tracks = json.loads(current_tracks.text)
|
||||||
|
|
||||||
tracks = []
|
tracks = []
|
||||||
|
|
Loading…
Reference in a new issue