1
0
mirror of https://github.com/spl0k/supysonic.git synced 2024-12-22 08:56:17 +00:00

Import cleanup

This commit is contained in:
Alban Féron 2021-01-16 12:27:11 +01:00
parent e22620b147
commit bba254f339
No known key found for this signature in database
GPG Key ID: 8CE0313646D16165
14 changed files with 20 additions and 17 deletions

View File

@ -9,7 +9,6 @@ API_VERSION = "1.10.2"
import binascii
import uuid
import functools
from flask import request
from flask import Blueprint
from pony.orm import ObjectNotFound
@ -26,13 +25,14 @@ api = Blueprint("api", __name__)
def api_routing(endpoint):
def decorator(func):
viewendpoint="{}.view".format(endpoint)
api.add_url_rule(endpoint,view_func=func, methods=["GET", "POST"])
api.add_url_rule(viewendpoint,view_func=func, methods=["GET", "POST"])
viewendpoint = "{}.view".format(endpoint)
api.add_url_rule(endpoint, view_func=func, methods=["GET", "POST"])
api.add_url_rule(viewendpoint, view_func=func, methods=["GET", "POST"])
return func
return decorator
@api.before_request
def set_formatter():
"""Return a function to create the response."""

View File

@ -21,7 +21,7 @@ from ..db import (
)
from ..db import now
from . import api, api_routing
from . import api_routing
from .exceptions import GenericError, NotFound

View File

@ -16,7 +16,7 @@ from ..db import StarredTrack, StarredAlbum, StarredArtist, StarredFolder
from ..db import RatingTrack, RatingFolder
from ..lastfm import LastFm
from . import api, get_entity, get_entity_id, api_routing
from . import get_entity, get_entity_id, api_routing
from .exceptions import AggregateException, GenericError, MissingParameter, NotFound

View File

@ -13,7 +13,7 @@ from pony.orm import ObjectNotFound, select, count
from ..db import Folder, Artist, Album, Track
from . import api, get_entity, get_entity_id, api_routing
from . import get_entity, get_entity_id, api_routing
@api_routing("/getMusicFolders")

View File

@ -8,7 +8,7 @@
from flask import request
from ..db import ChatMessage
from . import api, api_routing
from . import api_routing
@api_routing("/getChatMessages")

View File

@ -14,7 +14,7 @@ from ..daemon import DaemonClient
from ..daemon.exceptions import DaemonUnavailableError
from ..db import Track
from . import api, api_routing
from . import api_routing
from .exceptions import GenericError, MissingParameter, Forbidden

View File

@ -28,7 +28,7 @@ from zipstream import ZipFile
from ..cache import CacheMiss
from ..db import Track, Album, Folder, now
from . import api, get_entity, get_entity_id, api_routing
from . import get_entity, get_entity_id, api_routing
from .exceptions import (
GenericError,
NotFound,

View File

@ -11,7 +11,7 @@ from flask import request
from ..db import Playlist, User, Track
from . import api, get_entity, api_routing
from . import get_entity, api_routing
from .exceptions import Forbidden, MissingParameter, NotFound

View File

@ -9,7 +9,7 @@ from flask import request
from ..db import RadioStation
from . import api, get_entity, api_routing
from . import get_entity, api_routing
from .exceptions import Forbidden, MissingParameter

View File

@ -12,7 +12,7 @@ from flask import current_app
from ..daemon.client import DaemonClient
from ..daemon.exceptions import DaemonUnavailableError
from . import api, api_routing
from . import api_routing
from .user import admin_only
from .exceptions import ServerError

View File

@ -12,7 +12,7 @@ from pony.orm import select
from ..db import Folder, Track, Artist, Album
from . import api, api_routing
from . import api_routing
from .exceptions import MissingParameter

View File

@ -8,7 +8,7 @@
from flask import request
from . import api, api_routing
from . import api_routing
@api_routing("/ping")

View File

@ -23,6 +23,9 @@ def unsupported():
for m in methods:
api.add_url_rule(
"/{}".format(m), "unsupported", unsupported, methods=["GET", "POST"]
)
api.add_url_rule(
"/{}.view".format(m), "unsupported", unsupported, methods=["GET", "POST"]
)

View File

@ -11,7 +11,7 @@ from functools import wraps
from ..db import User
from ..managers.user import UserManager
from . import api, decode_password, api_routing
from . import decode_password, api_routing
from .exceptions import Forbidden, NotFound