-->

Access bokeh server URL

2019-06-10 19:41发布

问题:

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://bokeh.pydata.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

回答1:

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