Using arguments in server_document

I’m using bokeh with fastapi
I’ve followed what has been done in panel-multi

@router.get("/{model}", response_class=HTMLResponse, name='run_panel')
def panel(request: Request, model: str):
    if model not in titles:
        raise HTTPException(status_code=404, detail="Item not found")

    url = f"{model}"
    script = server_session(session_id=generate_session_id(SECRET_KEY, signed=True), url=url)
    return templates.TemplateResponse('records/panel.html', {
        "request": request,
        "script": script,
        "title": titles[model],

    num_process=1 if == "nt" else 2,

It works fine.

Now I would like to add some arguments to server_session.
With latest bokeh version it’s no longer possible so I tried to use server_document instead:
script = server_document(url=url, arguments= {"ID": 'tut'})

When I’m trying to use server_document, I end up with this warning
WARNING:tornado.access:403 GET /panel/mrecordpanel/autoload.js?bokeh-autoload-element=1002&bokeh-app-path=/panel/mrecordpanel&bokeh-absolute-url= ( 0.85ms

and no graph is displayed…

I must be missing some points here
Any help would be great,

HTTP 403 is “Forbidden”. If you are trying to embed the Bokeh server content in another page at a different URL, then the Bokeh server needs to be configured to allow embedding from that new Origin. Typically with pure Bokeh, you would configure --allow-websocket-origin to add the embedding page’s URL the origin allow-list (or set --allow-websocket-origin=* to turn off cross-origin checks altogether, and allow embedding from anywhere) . But I am not sure how Panel exposes these options in their API. That question is probably a better directed to the Holoviz Discourse since that is run by the maintainers of Panel.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.