Esempio n. 1
0
from auth_backends.urls import oauth2_urlpatterns
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin

from edx_api_doc_tools import make_api_info, make_docs_urls

from blockstore.apps.core import views as core_views
from blockstore.apps.bundles.tests.storage_utils import url_for_test_media

admin.autodiscover()

api_info = make_api_info(
    title="Blockstore API",
    version="v1",
    description="APIs for Openedx Blockstore"
)


urlpatterns = oauth2_urlpatterns + [
    url(r'^admin/', admin.site.urls),
    url(r'^api/', include('blockstore.apps.rest_api.urls', namespace='api')),
    # Use the same auth views for all logins, including those originating from the browseable API.
    url(r'^api-auth/', include((oauth2_urlpatterns, 'auth_backends'), namespace='rest_framework')),
    url(r'^auto_auth/$', core_views.AutoAuth.as_view(), name='auto_auth'),
    url(r'^health/$', core_views.health, name='health'),
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

urlpatterns += make_docs_urls(api_info)
Esempio n. 2
0
        }
        security_definitions = SwaggerDict.as_odict(security_definitions)
        return security_definitions


api_urls = [  # pylint: disable=invalid-name
    url(r'^enrollment/$', views.EdxappEnrollment.as_view(), name='edxapp-enrollment'),
    url(r'^grade/$', views.EdxappGrade.as_view(), name='edxapp-grade'),
    url(r'^user/$', views.EdxappUser.as_view(), name='edxapp-user'),
]

if getattr(settings, "EOX_CORE_ENABLE_UPDATE_USERS", None):
    api_urls += [
        url(r'^update-user/$', views.EdxappUserUpdater.as_view(), name='edxapp-user-updater'),
    ]

api_info = make_api_info(  # pylint: disable=invalid-name
    title="eox core",
    version="v1",
    email=" [email protected]",
    description="REST APIs to interact with edxapp",
)

docs_ui_view = get_schema_view(  # pylint: disable=invalid-name
    api_info,
    generator_class=APISchemaGenerator,
    public=True,
    permission_classes=(permissions.AllowAny,),
    patterns=api_urls,
).with_ui('swagger', cache_timeout=get_docs_cache_timeout())
Esempio n. 3
0
"""

from django.conf.urls import url

from edx_api_doc_tools import make_api_info, make_docs_urls

from .views import HedgehogInfoView, HedgehogUndocumentedView

urlpatterns = []

urlpatterns += [
    url(r'/api/hedgehog/v1/info', HedgehogInfoView.as_view()),
    url(r'/api/hedgehog/v1/undoc-view', HedgehogUndocumentedView.as_view()),
    url(r'/test/hedgehog/v1/info', HedgehogInfoView.as_view()),
    url(r'/test/hedgehog/v1/undoc-view', HedgehogUndocumentedView.as_view()),
]

display_urls = [
    url(r'/test/hedgehog/v1/info', HedgehogInfoView.as_view()),
]

urlpatterns += make_docs_urls(
    make_api_info(
        title="edX Hedgehog Service API",
        version="v1",
        email="*****@*****.**",
        description="A REST API for interacting with the edX hedgehog service.",
    ),
    api_url_patterns=display_urls,
)
Esempio n. 4
0

api_urls = [
    url(r"eox-tagging/api/", include("eox_tagging.api.urls"))
]

api_info = make_api_info(
    title="eox tagging",
    version="v1",
    email=" [email protected]",
    description=internal_utils.dedent("""\
    **eox tagging REST API**

    eox-tagging is a small plugin that provides the ability to ‘tag’ or label\
    certain objects of the Open edX platform (Courses, Course Enrollments,\
    Users). The tag contains the object that is being tagged, its identifier, a\
    ‘tag_type’ indicating the set of values the tag can have and ‘tag_value’\
    which holds a value of type ‘tag_type’. Additionally one can provide extra\
    info such as: Access level, or timestamps for when the tag should be considered\
    active. \

    eox tagging is meant to be a lightweight plugin with emphasis on flexibility,\
    most of the logic regarding the deactivation of tags at a given time must be\
    handled separately.
    """),
)

docs_ui_view = get_schema_view(
    api_info,
    generator_class=APISchemaGenerator,
    public=True,
    permission_classes=[permissions.AllowAny],
Esempio n. 5
0
import os

from auth_backends.urls import oauth2_urlpatterns
from django.conf import settings
from django.conf.urls import include, url
from django.contrib import admin
from edx_api_doc_tools import make_api_info, make_docs_urls

from classrooms.apps.api import urls as api_urls
from classrooms.apps.core import views as core_views

admin.autodiscover()

api_info = make_api_info(
    title="Classroom API",
    version="v1",
    description="APIs for Dicey Tech Classroom",
    email="*****@*****.**",
)

urlpatterns = oauth2_urlpatterns + [
    url(r"^admin/", admin.site.urls),
    url(r"^api/", include(api_urls)),
    url(r"^auto_auth/$", core_views.AutoAuth.as_view(), name="auto_auth"),
    url(r"",
        include("csrf.urls")),  # Include csrf urls from edx-drf-extensions
    url(r"^health/$", core_views.health, name="health"),
]

urlpatterns += make_docs_urls(api_info)

if settings.DEBUG and os.environ.get("ENABLE_DJANGO_TOOLBAR",
"""
Open API support.
"""

from edx_api_doc_tools import make_api_info
from rest_framework import serializers

api_info = make_api_info(
    title="Open edX API",
    version="v1",
    description="APIs for access to Open edX information",
    #terms_of_service="https://www.google.com/policies/terms/",         # TODO: Do we have these?
    email="*****@*****.**",
    #license=openapi.License(name="BSD License"),                       # TODO: What does this mean?
)


def cursor_paginate_serializer(inner_serializer_class):
    """
    Create a cursor-paginated version of a serializer.

    This is hacky workaround for an edx-api-doc-tools issue described here:
    https://github.com/edx/api-doc-tools/issues/32

    It assumes we are using cursor-style pagination and assumes a specific
    schema for the pages. It should be removed once we address the underlying issue.

    Arguments:
        inner_serializer_class (type): A subclass of ``Serializer``.

    Returns: type
Esempio n. 7
0
from . import api_renderer
from .apps.api import urls as api_urls
from .apps.core import views as core_views

admin.site.site_header = 'Registrar Service Administration'
admin.site.site_title = admin.site.site_header
admin.autodiscover()

app_name = 'registrar'

new_api_ui_view = make_docs_ui_view(
    make_api_info(
        title="Registrar API - New Documentation",
        version="v2",
        email="*****@*****.**",
        description=(
            "Administer student enrollments in degree-bearing edX programs. "
            "Please note that this documentation is a work-in-progress "
            "and should not be considered authoritative."),
    ))

urlpatterns = oauth2_urlpatterns + [
    # '/' and '/login' redirect to '/login/',
    # which attempts LMS OAuth and then redirects to api-docs.
    url(r'^/?$', RedirectView.as_view(url=settings.LOGIN_URL)),
    url(r'^login$', RedirectView.as_view(url=settings.LOGIN_URL)),

    # Use the same auth views for all logins,
    # including those originating from the browseable API.
    url(r'^api-auth/', include(oauth2_urlpatterns)),
Esempio n. 8
0
from django.conf.urls.static import static
from django.contrib import admin
from django.views.generic import RedirectView
from drf_yasg.views import get_schema_view
from edx_api_doc_tools import make_api_info
from rest_framework import permissions
from wagtail.admin import urls as wagtailadmin_urls
from wagtail.documents import urls as wagtaildocs_urls
from wagtail.core import urls as wagtail_urls

from designer.apps.core import views as core_views
from designer.apps.core.wagtailadmin.views import SiteCreationView

admin.autodiscover()

api_info = make_api_info(title="designer API", version="v1")
schema_view = get_schema_view(
    api_info,
    public=False,
    permission_classes=(permissions.AllowAny, ),
)

urlpatterns = oauth2_urlpatterns + [
    url(r'^api/', include('designer.apps.api.urls')),
    url(r'^api-docs/$',
        schema_view.with_ui('swagger', cache_timeout=0),
        name='schema-swagger-ui'),
    # Use the same auth views for all logins, including those originating from the browseable API.
    url(r'^api-auth/', include(oauth2_urlpatterns)),
    url(r'^auto_auth/$', core_views.AutoAuth.as_view(), name='auto_auth'),
    url(r'^health/$', core_views.health, name='health'),
Esempio n. 9
0
from . import api_renderer
from .apps.api import urls as api_urls
from .apps.core import views as core_views

admin.site.site_header = 'Registrar Service Administration'
admin.site.site_title = admin.site.site_header
admin.autodiscover()

app_name = 'registrar'
api_description_path = os.path.join(settings.PROJECT_ROOT, 'static',
                                    'api-description.html')
with open(api_description_path) as api_description_file:
    new_api_ui_view = make_docs_ui_view(
        make_api_info(
            title="Registrar API - Online Documentation",
            version="v2",
            email="*****@*****.**",
            description=api_description_file.read(),
        ))

urlpatterns = oauth2_urlpatterns + [
    # '/' and '/login' redirect to '/login/',
    # which attempts LMS OAuth and then redirects to api-docs.
    url(r'^/?$', RedirectView.as_view(url=settings.LOGIN_URL)),
    url(r'^login$', RedirectView.as_view(url=settings.LOGIN_URL)),

    # Use the same auth views for all logins,
    # including those originating from the browseable API.
    url(r'^api-auth/', include(oauth2_urlpatterns)),

    # NEW Swagger documentation UI, generated using edx-api-doc-tools.
    # TODO: Make this the default as part of MST-195.
Esempio n. 10
0
admin.site.site_header = 'Analytics Data API Service Administration'
admin.site.site_title = admin.site.site_header

urlpatterns = [
    url(r'^api-auth/', include('rest_framework.urls', 'rest_framework')),
    url(r'^api-token-auth/', obtain_auth_token),
    url(r'^api/', include('analytics_data_api.urls')),
    url(r'^status/$', views.StatusView.as_view(), name='status'),
    url(r'^authenticated/$',
        views.AuthenticationTestView.as_view(),
        name='authenticated'),
    url(r'^health/$', views.HealthView.as_view(), name='health'),
]

urlpatterns.append(url(r'', include('enterprise_data.urls')))

api_ui_view = make_docs_ui_view(api_info=make_api_info(
    title="edX Analytics Data API",
    version="v0",
    email="*****@*****.**"),
                                api_url_patterns=urlpatterns)

urlpatterns += [
    url(r'^docs/$', api_ui_view, name='api-docs'),
    url(r'^$', RedirectView.as_view(url='/docs')),  # pylint: disable=no-value-for-parameter
]

handler500 = 'analyticsdataserver.views.handle_internal_server_error'  # pylint: disable=invalid-name
handler404 = 'analyticsdataserver.views.handle_missing_resource_error'  # pylint: disable=invalid-name