python - Obtain JSON request in Bokeh server application -
i direct user page hosted bokeh server along bit of metadata. example might want direct user to
http://my-server/my-page?var=value
i {'var': 'value'}
request in bokeh server application code on python side can respond accordingly.
is possible? if so, how?
a bokeh core dev pointed me documentation page:
https://bokeh.pydata.org/en/latest/docs/user_guide/server.html#accessing-the-http-request
in particular, available on document object:
# request.arguments dict maps argument names lists of strings, # e.g, query string ?n=10 result in {'n': [b'10']} args = curdoc().session_context.request.arguments try: n = int(args.get('n')[0]) except: n = 200
Comments
Post a Comment