State#
The pn.state object makes various global state available and provides methods to manage that state.
Parameters#
access_tokenThe access token issued by the OAuth provider to authorize requests to its APIs.
busyA boolean value to indicate whether a callback is being actively processed.
cacheA global cache which can be used to share data between different processes.
cookiesHTTP request cookies for the current session.
curdocWhen running a server session this property holds the current bokeh Document.
locationIn a server context this provides read and write access to the URL:
hash: hash in window.location e.g. ‘#interact’pathname: pathname in window.location e.g. ‘/user_guide/Interact.html’search: search in window.location e.g. ‘?color=blue’reload: Reloads the page when the location is updated.href(readonly): The full url, e.g. ‘https://localhost:80?color=blue#interact’hostname(readonly): hostname in window.location e.g. ‘panel.holoviz.org’protocol(readonly): protocol in window.location e.g. ‘http:’ or ‘https:’port(readonly): port in window.location e.g. ‘80’
headersHTTP request headers for the current session.
refresh_tokenThe refresh token issued by the OAuth provider to authorize requests to its APIs (if available these are usually longer lived than the
access_token).
served
:Whether we are currently inside a script or notebook that is being served using panel serve.
session_argsWhen running a server session this return the request arguments.
session_infoA dictionary tracking information about server sessions:
total(int): The total number of sessions that have been openedlive(int): The current number of live sessionssessions(dict(str, dict)): A dictionary of session information:started: Timestamp when the session was startedrendered: Timestamp when the session was renderedended: Timestamp when the session was endeduser_agent: User-Agent header of client that opened the session
webdriverCaches the current webdriver to speed up export of bokeh models to PNGs.
Methods#
add_periodic_callbackSchedules a periodic callback to be run at an interval set by the period
as_cachedAllows caching data across sessions by memoizing on the provided key and keyword arguments to the provided function.
cancel_scheduledCancel a scheduled task by name.
executeExecutes both synchronous and asynchronous callbacks appropriately depending on the context the application is running in.
kill_all_serversStops all running server sessions.
onloadAllows defining a callback which is run when a server is fully loaded
scheduleSchedule a callback periodically at a specific time (click here for more details)
sync_busySync an indicator with a boolean value parameter to the busy property on state