MCPcopy Index your code
hub / github.com/pywebio/PyWebIO / webio_view

Function webio_view

pywebio/platform/django.py:75–98  ·  view source on GitHub ↗

Get the view function for running PyWebIO applications in Django. The view communicates with the browser by HTTP protocol. The arguments of ``webio_view()`` have the same meaning as for :func:`pywebio.platform.flask.webio_view`

(applications, cdn=True,
               session_expire_seconds=None,
               session_cleanup_interval=None,
               allowed_origins=None, check_origin=None)

Source from the content-addressed store, hash-verified

73
74
75def webio_view(applications, cdn=True,
76 session_expire_seconds=None,
77 session_cleanup_interval=None,
78 allowed_origins=None, check_origin=None):
79 """Get the view function for running PyWebIO applications in Django.
80 The view communicates with the browser by HTTP protocol.
81
82 The arguments of ``webio_view()`` have the same meaning as for :func:`pywebio.platform.flask.webio_view`
83 """
84 cdn = cdn_validation(cdn, 'error')
85 handler = HttpHandler(applications=applications, cdn=cdn,
86 session_expire_seconds=session_expire_seconds,
87 session_cleanup_interval=session_cleanup_interval,
88 allowed_origins=allowed_origins, check_origin=check_origin)
89
90 from django.views.decorators.csrf import csrf_exempt
91
92 @csrf_exempt
93 def view_func(request):
94 context = DjangoHttpContext(request)
95 return handler.handle_request(context)
96
97 view_func.__name__ = 'webio_view'
98 return view_func
99
100
101urlpatterns = []

Callers 1

wsgi_appFunction · 0.70

Calls 2

cdn_validationFunction · 0.85
HttpHandlerClass · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…