代码拉取完成,页面将自动刷新
from core import settings
settings.setup()
from common.errors import (
handler_validation_exception,
CMDError,
ServiceError,
handler_business_error,
handler_service_error,
handler_http_exception,
handler_server_rpc_error
)
from fastapi import FastAPI
from fastapi.exceptions import RequestValidationError, HTTPException
from starlette.exceptions import HTTPException as StarletteHTTPException
from db.errors import BusinessError
from common.permission_util import RpcIsAuthenticatedMiddleware
from rpc_api.conda import conda_router
from rpc_api.nvm import nvm_router
API_PREFIX = '/rpc_api'
app = FastAPI(
title='PyDep',
description='PyDepAPI接口文档',
version='1.0.0',
exception_handlers={
RequestValidationError: handler_validation_exception,
HTTPException: handler_http_exception,
StarletteHTTPException: handler_http_exception,
BusinessError: handler_business_error,
CMDError: handler_business_error,
ServiceError: handler_service_error,
Exception: handler_server_rpc_error
},
)
app.add_middleware(RpcIsAuthenticatedMiddleware)
app.include_router(conda_router, prefix=API_PREFIX)
app.include_router(nvm_router, prefix=API_PREFIX)
if __name__ == '__main__':
import uvicorn
uvicorn.run(app, host="0.0.0.0", port=2081)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。