将API添加到您的Pyramid Web应用程序的路由检查
项目描述
tomb_reflect
简介
轻松使您的Pyramid驱动的Web API可检查。
只需这样做
config.include('tomb_reflect', route_prefix='/api_info')
# You could pass options to tomb_reflect_add_views to add auth, etc.
config.tomb_reflect_add_views()
有了这个,您的应用程序现在可以响应2个新的URL。
第一个URL,/api_info/routes,返回路由列表
{
"hello": {
"route_pattern": "/hello"
},
"hello_name": {
"route_pattern": "/hello_name/{name}"
},
"tomb_reflect.routes#index": {
"route_pattern": "api_info/routes"
},
"tomb_reflect.routes#show": {
"route_pattern": "api_info/routes/{route_name}"
}
}
第二个URL,/api_info/routes/{route_name},返回特定路由的详细信息
{
"route_name": "hello",
"route_pattern": "/hello",
"view": "inventorysvc.views.hello.hello"
}
配置
如果您想使URL位于不同的根路径下,请更改您的 config.include 调用中的 route_prefix
config.include('tomb_reflect', route_prefix='/super/secret/place')
如果您想使URL仅在具有某些权限的情况下可见,需要特殊授权等,您可以将选项传递给 config.tomb_reflect_add_views
# You can pass options to tomb_reflect_add_views to add auth, etc.
config.tomb_reflect_add_views(
decorator=SomeCustomDecorator,
permission='reflect')
类似
pyramid-describe - 仅适用于使用 pyramid-controller 分发的应用程序
项目详情
关闭
tomb_reflect-0.0.1.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 829bb8e1accd078618c1c42917c59c607ad379fad75acc406ea35d137efb04bf |
|
MD5 | 4129ae33d870400fec212b6ba67dec25 |
|
BLAKE2b-256 | ee02cb46ceeb2f5fd333ca61cd2059a7096baf3618a87c75c1eb17808eed6689 |