Search code examples
pythontornadobokeh

Access bokeh server URL


I'd like to access my bokeh application's URL.

I tried:

curdoc().session_context.server_context.application_context.url

But it only gives me the last part of the URL.

Also, when acessing the HTTP request object from

curdoc().session_context.request

Only the arguments member can be queried (as defined in https://docs.bokeh.org/en/latest/docs/user_guide/server.html#accessing-the-http-request).

How do I get the complete URL of the running bokeh application?

Thanks


Solution

  • As suggested in the comments, this does not seem possible when using the bokeh server command.

    I managed to use os.getenv('HOSTNAME') and session_context.server_context.application_context.url to rebuild the full url.

    Thanks