From cf33f901ff4a9803a411313689eea9d0fc24d82d Mon Sep 17 00:00:00 2001 From: minus Date: Sun, 27 Oct 2019 16:03:18 +0100 Subject: [PATCH] Remove terms from path in random requests /api/request/random/ becomes /api/request/random?q= --- stewdio/app.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/stewdio/app.py b/stewdio/app.py index 3169d3b..b684be1 100644 --- a/stewdio/app.py +++ b/stewdio/app.py @@ -84,10 +84,11 @@ def request(hash, session): song = session.query(types.Song).filter(types.Song.hash.startswith(hash)).one() return queue_song(song.json()) -@app.route("/api/request/random/") +@app.route("/api/request/random") @with_pg_cursor @json_api -def request_random(terms, cur): +def request_random(cur): + terms = flask.request.args["q"] with db_session() as session: context = get_np_context(session) songs = search_internal(cur, context, terms) -- 2.45.2