without the embedding http://localhost:5006/emptydetails_graph?name=%sheehy%/autoload.js?bokeh-autoload-element=8a4a408c-f0ab-48f1-a482-d1a7c056e9c7 loads fine.
without the embedding [http://localhost:5006/emptydetails_graph?name=%sheehy%/autoload.js?bokeh-autoload-element=8a4a408c-f0ab-48f1-a482-d1a7c056e9c7](http://localhost:5006/emptydetails_graph?name=%sheehy%/autoload.js?bokeh-autoload-element=8a4a408c-f0ab-48f1-a482-d1a7c056e9c7) loads fine.
without the embedding [http://localhost:5006/emptydetails_graph?name=%sheehy%/autoload.js?bokeh-autoload-element=8a4a408c-f0ab-48f1-a482-d1a7c056e9c7](http://localhost:5006/emptydetails_graph?name=%sheehy%/autoload.js?bokeh-autoload-element=8a4a408c-f0ab-48f1-a482-d1a7c056e9c7) loads fine.
The Bokeh server accepts URL parameters when connections are made, and they are available to app code. But the way autoload_server currently constructs URLs is not compatible with URL parameters. You can see this by inspecting the script tag that gets generated:
In [5]: print(autoload_server(None, app_path="/foo?bar"))
Basically, any user-supplied URL params need to be detected, and moved to the proper place at the end in the full src URL that is generated. I thought there was an open issue for this, but I can't find it. It would be an immense help if you could make a new issue with all this information (I am putting out several fires at the moment and don't want this to get lost).
In the immediate term, the options I can recommend:
* "fix up" the script tag that is returned to you (hacky, but doable)
* embed using iframes instead of autoload_server
Fixing this should hopefully not be alot of work, I would schedule it for 0.12.5 once there is an issue.
Or, if you are looking for a small OSS contribution, you could poke around here:
Thank you Bryan. I fixed this issue in a really hacky way, but it works finally!
app_path = 'simple_bokeh'
argument = '&name=' + company
url = "http://127.0.0.1:5006/"
script = autoload_server(model=None,
app_path="/"+app_path ,
url= url)
#split script to get the ID
script_split = script.split('id="')
id = yo_split[1].split('"\n')[0]
#create new src
src = url + app_path + "/autoload.js?bokeh-autoload-element=" + id + argument
#create new script
script = ('<script src="' + src + '" id="' + id + '" data-bokeh-model-id="" data-bokeh-doc-id="" ></script>')
``
I appreciate the help, i'll make a new issue.
<details class='elided'>
<summary title='Show trimmed content'>···</summary>
On Tuesday, January 17, 2017 at 1:32:03 PM UTC-6, Bryan Van de ven wrote:
> The Bokeh server accepts URL parameters when connections are made, and they are available to app code. But the way autoload_server currently constructs URLs is not compatible with URL parameters. You can see this by inspecting the script tag that gets generated:
>
>
>
> In [5]: print(autoload_server(None, app_path="/foo?bar"))
>
>
>
> <script
>
> src="[http://localhost:5006/foo?bar/autoload.js?bokeh-autoload-element=e56d7065-48cf-4ac5-a80a-17b4ac5cf3cf](http://localhost:5006/foo?bar/autoload.js?bokeh-autoload-element=e56d7065-48cf-4ac5-a80a-17b4ac5cf3cf)"
>
> id="e56d7065-48cf-4ac5-a80a-17b4ac5cf3cf"
>
> data-bokeh-model-id=""
>
> data-bokeh-doc-id=""
>
> ></script>
>
>
>
> You can see the problem: "[http://localhost:5006/foo?bar/autoload.js?...](http://localhost:5006/foo?bar/autoload.js?...)." is not valid with the URL parameter "?bar" in the middle before "/autoload.js".
>
>
> Basically, any user-supplied URL params need to be detected, and moved to the proper place at the end in the full src URL that is generated. I thought there was an open issue for this, but I can't find it. It would be an immense help if you could make a new issue with all this information (I am putting out several fires at the moment and don't want this to get lost).
>
>
>
> In the immediate term, the options I can recommend:
>
>
>
> * "fix up" the script tag that is returned to you (hacky, but doable)
>
>
>
> * embed using iframes instead of autoload_server
>
>
>
> Fixing this should hopefully not be alot of work, I would schedule it for 0.12.5 once there is an issue.
>
>
> Or, if you are looking for a small OSS contribution, you could poke around here:
>
>
>
> [https://github.com/bokeh/bokeh/blob/master/bokeh/embed.py#L408-L425](https://github.com/bokeh/bokeh/blob/master/bokeh/embed.py#L408-L425)
>
>
>
> and look to make a PR to fix this, which would be helpful and appreciated.
>
>
>
> Thanks,
>
>
>
> Bryan
>
>
> > On Jan 17, 2017, at 1:02 PM, Rob Pritchard <[email protected]> wrote:
>
> >
> > removing the ?name=%' + company + '%' the app works fine. Are url parameters not allowed in bokeh?
>
> >
> >
> > On Monday, January 16, 2017 at 4:42:04 PM UTC-6, Rob Pritchard wrote:
>
> > Currently I am using 0.12.3
>
> >
> > Embedding without url parameters works fine.
>
> > app_path = '/emptydetails_graph'
>
> > script = autoload_server(model=None,app_path=app_path, url="[http://127.0.0.1:5006/](http://127.0.0.1:5006/)")
>
> >
> >
> > When I add a parameter:
>
> >
> > company = "name"
>
> > app_path = '/emptydetails_graph?name=' + "%" + company + "%"
>
> > script = autoload_server(model=None, app_path=app_path, url="[http://127.0.0.1:5006/](http://127.0.0.1:5006/)")
> >
> > i get an "Uncaught SyntaxError: Unexpected token <" error found in
>
> >
> > <!DOCTYPE html>
>
> > <html lang="en">
>
> > <head>
>
> > <meta charset="utf-8">
>
> > <title>Bokeh Application</title>
>
> >
> > <link rel="stylesheet" href="[http://127.0.0.1:5006/static/css/bokeh.min.css?v=882a547e86d77d573fefc67cb37bb345](http://127.0.0.1:5006/static/css/bokeh.min.css?v=882a547e86d77d573fefc67cb37bb345)" type="text/css" />
>
> > <link rel="stylesheet" href="[http://127.0.0.1:5006/static/css/bokeh-widgets.min.css?v=0161cfada7394f178079e5d79c611b3f](http://127.0.0.1:5006/static/css/bokeh-widgets.min.css?v=0161cfada7394f178079e5d79c611b3f)" type="text/css" />
>
> >
> > <script type="text/javascript" src="[http://127.0.0.1:5006/static/js/bokeh.min.js?v=2489d3f55e068b60ead4375a27399865](http://127.0.0.1:5006/static/js/bokeh.min.js?v=2489d3f55e068b60ead4375a27399865)"></script>
>
> > <script type="text/javascript" src="[http://127.0.0.1:5006/static/js/bokeh-widgets.min.js?v=ce98d7a310ecac8b77374f1ac7c4819a](http://127.0.0.1:5006/static/js/bokeh-widgets.min.js?v=ce98d7a310ecac8b77374f1ac7c4819a)"></script>
>
> > <script type="text/javascript">
>
> > Bokeh.set_log_level("info");
>
> > </script>
>
> > <style>
>
> > html {
>
> > width: 100%;
>
> > height: 100%;
>
> > }
>
> > body {
>
> > width: 90%;
>
> > height: 100%;
>
> > margin: auto;
>
> > }
>
> > </style>
>
> > </head>
>
> > <body>
>
> >
> > <div class="bk-root">
>
> > <div class="plotdiv" id="644137de-dbe6-4329-b56f-58f245085659"></div>
>
> > </div>
>
> >
> > <script type="text/javascript">
>
> > Bokeh.$(function() {
>
> > Bokeh.safely(function() {
>
> > var docs_json = {};
>
> > var render_items = [{"elementid":"644137de-dbe6-4329-b56f-58f245085659","sessionid":"B90QIGxUPWfZBjWbUlHgAIWB0pejuj9lgo90swPIlHnz","use_for_title":true}];
>
> >
> > Bokeh.embed.embed_items(docs_json, render_items, "ws://[127.0.0.1:5006/emptydetails_graph/ws](http://127.0.0.1:5006/emptydetails_graph/ws)");
>
> > });
>
> > });
>
> > </script>
>
> > </body>
>
> > </html>
>
> >
> >
> >
> >
> > these are both loaded within:
>
> > <div class="bk-root">
>
> > {{ the_script|safe }}
>
> > </div>
>
> >
> >
> > without the embedding [http://localhost:5006/emptydetails_graph?name=%sheehy%/autoload.js?bokeh-autoload-element=8a4a408c-f0ab-48f1-a482-d1a7c056e9c7](http://localhost:5006/emptydetails_graph?name=%sheehy%/autoload.js?bokeh-autoload-element=8a4a408c-f0ab-48f1-a482-d1a7c056e9c7) loads fine.
>
> >
> >
> >
> >
> >
> >
> >
> >
> > --
> > You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
>
> > To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
>
> > To post to this group, send email to [email protected].
>
> > To view this discussion on the web visit [https://groups.google.com/a/continuum.io/d/msgid/bokeh/8e87caa6-4b59-40a7-b779-bf03623cdb95%40continuum.io](https://groups.google.com/a/continuum.io/d/msgid/bokeh/8e87caa6-4b59-40a7-b779-bf03623cdb95%40continuum.io).
>
> > For more options, visit [https://groups.google.com/a/continuum.io/d/optout](https://groups.google.com/a/continuum.io/d/optout).
>
>
>
</details>