Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from flask import Flask, redirect, url_for, render_template
- from flask_dance.contrib.spotify import make_spotify_blueprint, spotify
- app = Flask(__name__)
- app.secret_key = "supersekrit"
- spotify_blueprint = make_spotify_blueprint(
- client_id="****", client_secret="****", scope=["user-follow-read"])
- app.register_blueprint(spotify_blueprint, url_prefix="/spotify_login")
- @app.route('/')
- def hello_world():
- data = spotify.get("v1/me/following?type=artist")
- if data.ok:
- return data.json()
- else:
- return "Hello World Hope"
- @app.route('/spotify')
- def spotify_login():
- if not spotify.authorized:
- return redirect(url_for("spotify.login"))
- data = spotify.get("v1/me/following?type=artist")
- if data.ok:
- return data.json()
- else:
- return "Bad Data"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement