~minus/stewdio-api

cf33f901ff4a9803a411313689eea9d0fc24d82d — minus 3 years ago 1ccdaf4
Remove terms from path in random requests

/api/request/random/<terms> becomes /api/request/random?q=<terms>
1 files changed, 3 insertions(+), 2 deletions(-)

M stewdio/app.py
M stewdio/app.py => stewdio/app.py +3 -2
@@ 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/<terms>")
@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)