当前位置: 首页>>代码示例>>Python>>正文


Python schemas.SchemaGenerator方法代码示例

本文整理汇总了Python中rest_framework.schemas.SchemaGenerator方法的典型用法代码示例。如果您正苦于以下问题:Python schemas.SchemaGenerator方法的具体用法?Python schemas.SchemaGenerator怎么用?Python schemas.SchemaGenerator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在rest_framework.schemas的用法示例。


在下文中一共展示了schemas.SchemaGenerator方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_docs_view

# 需要导入模块: from rest_framework import schemas [as 别名]
# 或者: from rest_framework.schemas import SchemaGenerator [as 别名]
def get_docs_view(
        title=None, description=None, schema_url=None, public=True,
        patterns=None, generator_class=SchemaGenerator,
        authentication_classes=api_settings.DEFAULT_AUTHENTICATION_CLASSES,
        permission_classes=api_settings.DEFAULT_PERMISSION_CLASSES,
        renderer_classes=None):

    if renderer_classes is None:
        renderer_classes = [DocumentationRenderer, CoreJSONRenderer]

    return get_schema_view(
        title=title,
        url=schema_url,
        description=description,
        renderer_classes=renderer_classes,
        public=public,
        patterns=patterns,
        generator_class=generator_class,
        authentication_classes=authentication_classes,
        permission_classes=permission_classes,
    ) 
开发者ID:BeanWei,项目名称:Dailyfresh-B2C,代码行数:23,代码来源:documentation.py

示例2: get_schemajs_view

# 需要导入模块: from rest_framework import schemas [as 别名]
# 或者: from rest_framework.schemas import SchemaGenerator [as 别名]
def get_schemajs_view(
        title=None, description=None, schema_url=None, public=True,
        patterns=None, generator_class=SchemaGenerator,
        authentication_classes=api_settings.DEFAULT_AUTHENTICATION_CLASSES,
        permission_classes=api_settings.DEFAULT_PERMISSION_CLASSES):
    renderer_classes = [SchemaJSRenderer]

    return get_schema_view(
        title=title,
        url=schema_url,
        description=description,
        renderer_classes=renderer_classes,
        public=public,
        patterns=patterns,
        generator_class=generator_class,
        authentication_classes=authentication_classes,
        permission_classes=permission_classes,
    ) 
开发者ID:BeanWei,项目名称:Dailyfresh-B2C,代码行数:20,代码来源:documentation.py

示例3: get

# 需要导入模块: from rest_framework import schemas [as 别名]
# 或者: from rest_framework.schemas import SchemaGenerator [as 别名]
def get(self, request):
        generator = SchemaGenerator(
            title="RDMO API",
            patterns=urlpatterns,
            url=request.path
        )
        schema = generator.get_schema(request=request)
        return Response(schema) 
开发者ID:rdmorganiser,项目名称:rdmo,代码行数:10,代码来源:swagger.py

示例4: get

# 需要导入模块: from rest_framework import schemas [as 别名]
# 或者: from rest_framework.schemas import SchemaGenerator [as 别名]
def get(self, request):
        generator = SchemaGenerator(title='Discovery API')
        schema = generator.get_schema(request=request)
        if not schema:
            # get_schema() uses the same permissions check as the API endpoints.
            # If we don't get a schema document back, it means the user is not
            # authenticated or doesn't have permission to access the API.
            # api_docs_permission_denied_handler() handles both of these cases.
            return api_docs_permission_denied_handler(request)
        elif schema and request.user and request.user.is_anonymous:
            return _redirect_to_login(request)

        return Response(schema) 
开发者ID:edx,项目名称:course-discovery,代码行数:15,代码来源:views.py

示例5: get

# 需要导入模块: from rest_framework import schemas [as 别名]
# 或者: from rest_framework.schemas import SchemaGenerator [as 别名]
def get(self, request):
        params = {"urlconf": "api.v2.urls"}
        if "HTTP_X_FORWARDED_HOST" in request.META:
            # forwarding via vcr-web
            # params["url"] = "{}://{}/api".format(
            #    request.META.get("HTTP_X_FORWARDED_PROTO", "http"),
            #    request.META["HTTP_X_FORWARDED_HOST"])
            params["url"] = "/api"
        else:
            params["url"] = "/api/v2"
        generator = SchemaGenerator(**params)
        schema = generator.get_schema(request=request)
        return Response(schema) 
开发者ID:bcgov,项目名称:aries-vcr,代码行数:15,代码来源:swagger.py

示例6: get

# 需要导入模块: from rest_framework import schemas [as 别名]
# 或者: from rest_framework.schemas import SchemaGenerator [as 别名]
def get(self, request):
        generator = SchemaGenerator()
        schema = generator.get_schema(request=request)
        return Response(schema) 
开发者ID:IBM-Blockchain-Identity,项目名称:indy-ssivc-tutorial,代码行数:6,代码来源:urls.py

示例7: schema_view

# 需要导入模块: from rest_framework import schemas [as 别名]
# 或者: from rest_framework.schemas import SchemaGenerator [as 别名]
def schema_view(request):
    """
    Swagger test API
    """
    generator = SchemaGenerator(title='Rest Swagger')
    schema = generator.get_schema(request=request)

    return Response(schema) 
开发者ID:SystangoTechnologies,项目名称:DjangoUnboxed,代码行数:10,代码来源:swagger.py

示例8: include_docs_urls

# 需要导入模块: from rest_framework import schemas [as 别名]
# 或者: from rest_framework.schemas import SchemaGenerator [as 别名]
def include_docs_urls(
        title=None, description=None, schema_url=None, public=True,
        patterns=None, generator_class=SchemaGenerator,
        authentication_classes=api_settings.DEFAULT_AUTHENTICATION_CLASSES,
        permission_classes=api_settings.DEFAULT_PERMISSION_CLASSES,
        renderer_classes=None):
    docs_view = get_docs_view(
        title=title,
        description=description,
        schema_url=schema_url,
        public=public,
        patterns=patterns,
        generator_class=generator_class,
        authentication_classes=authentication_classes,
        renderer_classes=renderer_classes,
        permission_classes=permission_classes,
    )
    schema_js_view = get_schemajs_view(
        title=title,
        description=description,
        schema_url=schema_url,
        public=public,
        patterns=patterns,
        generator_class=generator_class,
        authentication_classes=authentication_classes,
        permission_classes=permission_classes,
    )
    urls = [
        url(r'^$', docs_view, name='docs-index'),
        url(r'^schema.js$', schema_js_view, name='schema-js')
    ]
    return include((urls, 'api-docs'), namespace='api-docs') 
开发者ID:BeanWei,项目名称:Dailyfresh-B2C,代码行数:34,代码来源:documentation.py

示例9: get

# 需要导入模块: from rest_framework import schemas [as 别名]
# 或者: from rest_framework.schemas import SchemaGenerator [as 别名]
def get(self, request):
        params = {
            "urlconf": "api_v2.urls",
        }
        if "HTTP_X_FORWARDED_HOST" in request.META:
            # forwarding via tob-web
            #params["url"] = "{}://{}/api".format(
            #    request.META.get("HTTP_X_FORWARDED_PROTO", "http"),
            #    request.META["HTTP_X_FORWARDED_HOST"])
            params["url"] = "/api"
        else:
            params["url"] = "/api/v2"
        generator = SchemaGenerator(**params)
        schema = generator.get_schema(request=request)
        return Response(schema) 
开发者ID:bcgov,项目名称:TheOrgBook,代码行数:17,代码来源:swagger.py

示例10: get

# 需要导入模块: from rest_framework import schemas [as 别名]
# 或者: from rest_framework.schemas import SchemaGenerator [as 别名]
def get(self, _request):
        generator = schemas.SchemaGenerator(title='Analytics API')
        return Response(generator.get_schema()) 
开发者ID:edx,项目名称:edx-analytics-data-api,代码行数:5,代码来源:views.py


注:本文中的rest_framework.schemas.SchemaGenerator方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。