update requirements.txt
This commit is contained in:
25
api.py
25
api.py
@@ -4,7 +4,8 @@
|
||||
# $ cd /var/sites/api.lockstep.at
|
||||
# $ source .venv/bin/activate
|
||||
# $ source .env
|
||||
# $ flask --app api run --port 8000
|
||||
# $ # NO. flask --app api run --port 8000
|
||||
# $ python3 api.py # runs __main__ and allows code reloading.
|
||||
|
||||
# Authomatic 1.3.0 is not compatible with Python 3.12+
|
||||
# patch: /var/sites/api.lockstep.at/.venv/lib/python3.13/site-packages/authomatic/providers/__init__.py
|
||||
@@ -30,6 +31,8 @@ from authomatic.adapters import WerkzeugAdapter
|
||||
from authomatic.providers import oauth2
|
||||
from authomatic.providers import PROVIDER_ID_MAP as AUTHOMATIC_PROVIDER_ID_MAP
|
||||
|
||||
import requests
|
||||
|
||||
|
||||
# ----------------------------
|
||||
# Custom Spotify provider
|
||||
@@ -469,6 +472,26 @@ def me():
|
||||
"stored_expires_at": row["expires_at"],
|
||||
})
|
||||
|
||||
@app.route("/playlists")
|
||||
def playlists():
|
||||
spotify_user_id = "cidermole"
|
||||
access_token = get_valid_access_token(spotify_user_id)
|
||||
|
||||
"""
|
||||
user_id = "Sara"
|
||||
url = f"https://api.spotify.com/v1/users/{user_id}/playlists"
|
||||
# -> 403 Forbidden
|
||||
"""
|
||||
url = f"https://api.spotify.com/v1/me/playlists"
|
||||
headers={"Authorization": f"Bearer {access_token}"}
|
||||
r = requests.get(url, headers=headers)
|
||||
# TODO: pagination (limit,offset)
|
||||
|
||||
return jsonify({
|
||||
"ok": True,
|
||||
"response": r.json()
|
||||
})
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
init_db()
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
flask
|
||||
werkzeug
|
||||
authomatic
|
||||
authomatic
|
||||
requests
|
||||
numpy
|
||||
scipy
|
||||
|
||||
Reference in New Issue
Block a user