beep boop
This commit is contained in:
parent
ca02c9a731
commit
5c8fefb605
8
base.py
8
base.py
@ -47,15 +47,15 @@ allow_headers=["*"])
|
||||
Blacklisted routes
|
||||
"""
|
||||
|
||||
@app.get("/")
|
||||
@app.get("/", include_in_schema=False)
|
||||
def disallow_get():
|
||||
return util.get_blocked_response()
|
||||
|
||||
@app.head("/")
|
||||
@app.head("/", include_in_schema=False)
|
||||
def base_head():
|
||||
return
|
||||
|
||||
@app.get("/{path}")
|
||||
@app.get("/{path}", include_in_schema=False)
|
||||
def disallow_get_any(request: Request, var: Any = None): # pylint: disable=unused-argument
|
||||
path = request.path_params['path']
|
||||
if not (
|
||||
@ -68,7 +68,7 @@ def disallow_get_any(request: Request, var: Any = None): # pylint: disable=unuse
|
||||
logging.info("OK, %s",
|
||||
path)
|
||||
|
||||
@app.post("/")
|
||||
@app.post("/", include_in_schema=False)
|
||||
def disallow_base_post():
|
||||
return util.get_blocked_response()
|
||||
|
||||
|
@ -37,16 +37,20 @@ class ValidLyricRequest(BaseModel):
|
||||
src: str
|
||||
excluded_sources: list | None = None
|
||||
|
||||
class Config: # pylint: disable=missing-class-docstring too-few-public-methods
|
||||
schema_extra = {
|
||||
"example": {
|
||||
model_config = {
|
||||
"json_schema_extra": {
|
||||
"examples": [
|
||||
{
|
||||
"a": "eminem",
|
||||
"s": "rap god",
|
||||
"src": "WEB",
|
||||
"extra": True,
|
||||
"lrc": False,
|
||||
}
|
||||
"excluded_sources": [],
|
||||
}]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class ValidTypeAheadRequest(BaseModel):
|
||||
"""
|
||||
@ -118,7 +122,8 @@ class LyricSearch(FastAPI):
|
||||
self.lrc_regex = regex.compile(r'\[([0-9]{2}:[0-9]{2})\.[0-9]{1,3}\](\s(.*)){0,}')
|
||||
|
||||
for endpoint, handler in self.endpoints.items():
|
||||
app.add_api_route(f"/{endpoint}", handler, methods=["POST", "GET"])
|
||||
_schema_include = endpoint in ["lyric_search"]
|
||||
app.add_api_route(f"/{endpoint}", handler, methods=["POST"], include_in_schema=_schema_include)
|
||||
|
||||
# async def lyric_cache_list_handler(self):
|
||||
# """
|
||||
@ -172,7 +177,7 @@ class LyricSearch(FastAPI):
|
||||
- **a**: artist
|
||||
- **s**: song
|
||||
- **t**: track (artist and song combined) [used only if a & s are not used]
|
||||
- **extra**: include extra details in response [optional, default: false] [unused]
|
||||
- **extra**: include extra details in response [optional, default: false]
|
||||
- **lrc**: Request LRCs?
|
||||
- **sub**: text to search within lyrics, if found lyrics will begin at found verse [optional, default: none]
|
||||
- **src**: the script/utility which initiated the request
|
||||
@ -252,6 +257,7 @@ class LyricSearch(FastAPI):
|
||||
REMOVE BELOW AFTER TESTING IS DONE
|
||||
"""
|
||||
|
||||
# if not data.extra:
|
||||
# result.pop('src')
|
||||
if not data.extra:
|
||||
result.pop('src')
|
||||
|
||||
return result
|
||||
|
Loading…
x
Reference in New Issue
Block a user