获取bokeh应用程序的URL参数 [英] Get URL parameters for bokeh application

查看:81
本文介绍了获取bokeh应用程序的URL参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我正在开发bokeh应用程序以执行一些分析.我想从服务器获取URL参数,以便可以决定在应用程序中呈现哪些数据.

Hi I am developing a bokeh application to perform some analysis. I want to get the URL parameters from the server so I can decide which data to render in the application.

当前,我可以使用以下配置来路由http://127.0.0.1:5006/bokeh/videos/?hello=1之类的URL,但是有什么方法可以从应用程序中获取GET参数{'hello':'1'}?

Currently I can route URLs like http://127.0.0.1:5006/bokeh/videos/?hello=1 with the following configuration, but is there a way I can get the GET parameters {'hello':'1'} from the application?

@bokeh_app.route("/bokeh/analysis/")
@object_page("analysis")
def make_analysis():
    app = AnalysisApp.create()
    return app

推荐答案

对于Flask(内置Bokeh服务器),您可以使用以下地址访问网址参数:

For Flask (which Bokeh server is built on), you'd access url parameters using:

from flask import request

@bokeh_app.route("/bokeh/analysis/")
@object_page("analysis")
    def make_analysis():
    args = request.args
    app = AnalysisApp.create()
    return app

(请求对象由app.route装饰器添加到功能范围中)

(the request object gets added to the function scope by the app.route decorator)

这篇关于获取bokeh应用程序的URL参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆