Spaces:
Running
Running
File size: 843 Bytes
0a1b571 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
from typing import Optional
from fastapi import Depends, Header
from hibiapi.api.pixiv import NetRequest, PixivConstants, PixivEndpoints
from hibiapi.utils.log import logger
from hibiapi.utils.routing import EndpointRouter
if not (refresh_tokens := PixivConstants.CONFIG["account"]["token"].as_str_seq()):
logger.warning("Pixiv API token is not set, pixiv endpoint will be unavailable.")
PixivConstants.CONFIG["enabled"].set(False)
async def accept_language(
accept_language: Optional[str] = Header(
None,
description="Accepted tag translation language",
)
):
return accept_language
__mount__, __config__ = "pixiv", PixivConstants.CONFIG
router = EndpointRouter(tags=["Pixiv"], dependencies=[Depends(accept_language)])
router.include_endpoint(PixivEndpoints, api_root := NetRequest(refresh_tokens))
|