mirror of
https://github.com/spl0k/supysonic.git
synced 2024-12-22 08:56:17 +00:00
Import cleanup
This commit is contained in:
parent
e22620b147
commit
bba254f339
@ -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."""
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
@ -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")
|
||||
|
@ -8,7 +8,7 @@
|
||||
from flask import request
|
||||
|
||||
from ..db import ChatMessage
|
||||
from . import api, api_routing
|
||||
from . import api_routing
|
||||
|
||||
|
||||
@api_routing("/getChatMessages")
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
from flask import request
|
||||
|
||||
from . import api, api_routing
|
||||
from . import api_routing
|
||||
|
||||
|
||||
@api_routing("/ping")
|
||||
|
@ -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"]
|
||||
)
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user