弃用端点
弃用命令对于维护OpenBB平台至关重要。本指南概述了弃用端点的过程。
-
添加将替换已弃用端点的新端点。
-
添加弃用警告
导航到要弃用的端点所在的路由器。将
deprecated
标志设置为True
,并在装饰器中添加deprecation=OpenBBDeprecationWarning(…)
参数。参考以下示例:
from openbb_core.app.deprecation import OpenBBDeprecationWarning
@router.command(
model="MarketIndices",
deprecated=True,
deprecation=OpenBBDeprecationWarning(
message="This endpoint is deprecated; use `/index/price/historical` instead.",
since=(4, 1),
expected_removal=(4, 5),
),
)
async def market(
cc: CommandContext,
provider_choices: ProviderChoices,
standard_params: StandardParams,
extra_params: ExtraParams,
) -> OBBject:
"""Historical Market Indices."""
return await OBBject.from_query(Query(**locals())) -
获得OpenBB平台维护者的批准:我们将帮助您确定弃用警告的适当版本,并将更改传达给可能依赖您要弃用的端点的相关人员。
-
按我们所说的移除 - 端点将在弃用警告中指定的版本中被移除。