Sending URL parameter from Flask to a Bokeh server

試著忘記壹切 提交于 2019-12-01 21:40:21

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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!