Sending URL parameter from Flask to a Bokeh server

前端 未结 1 711
臣服心动
臣服心动 2021-01-20 01:30

I\'m trying to integrate a Bokeh \"autoloaded\" server into a Flask app where the set of data to load would be chosen by the user on another page.

The ID of this set

相关标签:
1条回答
  • 2021-01-20 02:32

    You can do it by appending to the src attribute of the <script> tag returned from autoload_server. Check out my function appendQuery in the source for this question

    def appendQuery( script , key , value) :
        # Pass along the parameter as a query string to the script's src url: TODO this will formally be introduced in next release of Bokeh to avoid this hack
        script_list = script.split("\n")
        idxSrcAttr = 2
        script_list[idxSrcAttr] = script_list[idxSrcAttr][:-1] + "&{}={}\"".format( key , value )
        script = "\n".join(script_list)
        return script
    

    This is methodology is supposed to be formalized in an upcoming Bokeh release according to... https://github.com/bokeh/bokeh/issues/5992#issuecomment-287232101

    0 讨论(0)
提交回复
热议问题