From 810c288d73d53a4f9b202d054cdbf10213afc50e Mon Sep 17 00:00:00 2001 From: Alban Date: Thu, 22 Nov 2012 14:51:43 +0100 Subject: [PATCH] Some clients do POST requests --- api/albums_songs.py | 2 +- api/browse.py | 6 +++--- api/media.py | 4 ++-- api/system.py | 4 ++-- api/user.py | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/api/albums_songs.py b/api/albums_songs.py index 741343b..6d564ad 100755 --- a/api/albums_songs.py +++ b/api/albums_songs.py @@ -6,7 +6,7 @@ from db import Track import random import uuid -@app.route('/rest/getRandomSongs.view') +@app.route('/rest/getRandomSongs.view', methods = [ 'GET', 'POST' ]) def rand_songs(): size = request.args.get('size', '10') genre, fromYear, toYear, musicFolderId = map(request.args.get, [ 'genre', 'fromYear', 'toYear', 'musicFolderId' ]) diff --git a/api/browse.py b/api/browse.py index bf38b61..b7ce40d 100755 --- a/api/browse.py +++ b/api/browse.py @@ -5,7 +5,7 @@ from web import app from db import Folder, Artist, Album, Track import uuid, time, string -@app.route('/rest/getMusicFolders.view') +@app.route('/rest/getMusicFolders.view', methods = [ 'GET', 'POST' ]) def list_folders(): return request.formatter({ 'musicFolders': { @@ -16,7 +16,7 @@ def list_folders(): } }) -@app.route('/rest/getIndexes.view') +@app.route('/rest/getIndexes.view', methods = [ 'GET', 'POST' ]) def list_indexes(): musicFolderId = request.args.get('musicFolderId') ifModifiedSince = request.args.get('ifModifiedSince') @@ -83,7 +83,7 @@ def list_indexes(): } }) -@app.route('/rest/getMusicDirectory.view') +@app.route('/rest/getMusicDirectory.view', methods = [ 'GET', 'POST' ]) def show_directory(): did = request.args.get('id') if not did: diff --git a/api/media.py b/api/media.py index 9ad288d..54516b5 100755 --- a/api/media.py +++ b/api/media.py @@ -7,7 +7,7 @@ from db import Track, Folder import config import os.path, uuid -@app.route('/rest/stream.view') +@app.route('/rest/stream.view', methods = [ 'GET', 'POST' ]) def stream_media(): id, maxBitRate, format, timeOffset, size, estimateContentLength = map(request.args.get, [ 'id', 'maxBitRate', 'format', 'timeOffset', 'size', 'estimateContentLength' ]) if not id: @@ -41,7 +41,7 @@ def stream_media(): return send_file(track.path) -@app.route('/rest/getCoverArt.view') +@app.route('/rest/getCoverArt.view', methods = [ 'GET', 'POST' ]) def cover_art(): id = request.args.get('id') if not id: diff --git a/api/system.py b/api/system.py index 1fc85d8..d76ee47 100755 --- a/api/system.py +++ b/api/system.py @@ -3,11 +3,11 @@ from flask import request from web import app -@app.route('/rest/ping.view') +@app.route('/rest/ping.view', methods = [ 'GET', 'POST' ]) def ping(): return request.formatter({}) -@app.route('/rest/getLicense.view') +@app.route('/rest/getLicense.view', methods = [ 'GET', 'POST' ]) def license(): return request.formatter({ 'license': { 'valid': False } }) diff --git a/api/user.py b/api/user.py index 087e157..9e1c945 100755 --- a/api/user.py +++ b/api/user.py @@ -4,7 +4,7 @@ from flask import request from web import app from db import User -@app.route('/rest/getUser.view') +@app.route('/rest/getUser.view', methods = [ 'GET', 'POST' ]) def user_info(): username = request.args.get('username') if username is None: