MCPcopy Create free account
hub / github.com/pywebio/PyWebIO / hold

Function hold

pywebio/session/__init__.py:295–317  ·  view source on GitHub ↗

Keep the session alive until the browser page is closed by user. .. attention:: Since PyWebIO v1.4, in :ref:`server mode `, it's no need to call this function manually, PyWebIO will automatically hold the session for you when needed. The only case to use it

()

Source from the content-addressed store, hash-verified

293
294@chose_impl
295def hold():
296 """Keep the session alive until the browser page is closed by user.
297
298 .. attention::
299
300 Since PyWebIO v1.4, in :ref:`server mode <server_mode>`, it&#x27;s no need to call this function manually,
301 PyWebIO will automatically hold the session for you when needed.
302 The only case to use it is to prevent the application from exiting in script mode.
303
304 In case you use the previous version of PyWebIO (we strongly recommend that you upgrade to the latest version),
305 here is the old document for ``hold()``:
306
307 After the PyWebIO session closed, the functions that need communicate with the PyWebIO server
308 (such as the event callback of `put_buttons()` and download link of `put_file()`) will not work.
309 You can call the ``hold()`` function at the end of the task function to hold the session,
310 so that the event callback and download link will always be available before the browser page is closed by user.
311
312 """
313 while True:
314 try:
315 yield next_client_event()
316 except SessionException:
317 return
318
319
320def download(name, content):

Callers 2

_start_main_taskMethod · 0.85
main_taskMethod · 0.85

Calls 1

next_client_eventFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…