# Bokeh HTML Requests Advice

**URL:** <https://discourse.bokeh.org/t/bokeh-html-requests-advice/1567>\
**Category:** Community Support\
**Created:** [September 13, 2016, 3:33pm UTC](https://discourse.bokeh.org/t/bokeh-html-requests-advice/1567 "2016-09-13T15:33:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Robbie\_Pritchard](https://discourse.bokeh.org/letter_avatar_proxy/v4/letter/r/bc8723/32.png) [@Robbie\_Pritchard](https://discourse.bokeh.org/u/Robbie_Pritchard)\
**Post date:** [September 13, 2016, 3:33pm UTC](https://discourse.bokeh.org/t/bokeh-html-requests-advice/1567/1 "2016-09-13T15:33:19Z")

</div>

I’m currently running Bokeh 0.12.1 with Django 1.9.8.

I’m running an app with  
bokeh serve emptydetails\_graph.py

``

Let’s say the emptydetails\_graph.py running on the bokeh server is this:

```auto
from bokeh.plotting import figure, show, output_server

p = figure(title="Server Plot")
p.circle([1, 2, 3], [4, 5, 6])

output_server("hover")

show(p)

```

I would like to pass an argument from Django to start a new session similar to this:

```auto
from bokeh.plotting import figure, show, output_server
p = figure(title= **STRING PARAMETER FROM DJANGO** )
p.circle([1, 2, 3], [4, 5, 6])

output_server("hover")

show(p)

```

Obviously my use case is different, the main goal being I would like to pass a string from Django to a Bokeh App, when creating a new session.

```auto
the_script = autoload_server(model=None,app_path='/emptydetails_graph',url="http://127.0.0.1:5006/", **STRING PARAMETER HERE** )

```

How would I do this?

```auto

```

---

<div class="post-metadata">

**Author:** ![Robbie\_Pritchard](https://discourse.bokeh.org/letter_avatar_proxy/v4/letter/r/bc8723/32.png) [@Robbie\_Pritchard](https://discourse.bokeh.org/u/Robbie_Pritchard)\
**Post date:** [September 13, 2016, 4:33pm UTC](https://discourse.bokeh.org/t/bokeh-html-requests-advice/1567/2 "2016-09-13T16:33:49Z")

</div>

I read throught the docs and found this [http://bokeh.pydata.org/en/latest/docs/user\_guide/server.html#accessing-the-http-request](http://bokeh.pydata.org/en/latest/docs/user_guide/server.html#accessing-the-http-request) whcih would tell me that my bokeh app should include:

```auto
**imports**

```

```auto

```

```auto
args = curdoc().session_context.request.arguments

```

```auto

p = figure(title=**string(args.get('Name')[0]**)
p.circle([1, 2, 3], [4, 5, 6])

output_server("hover")

show(p)

yet I am still confused on how to set the arguments with autoload_server

```

the\_script = autoload\_server(model=None,app\_path=‘/emptydetails\_graph’,url=“[http://127.0.0.1:5006/](http://127.0.0.1:5006/)”)

> **···**
>
> On Tuesday, September 13, 2016 at 10:33:20 AM UTC-5, Robbie Pritchard wrote:
> 
> > I’m currently running Bokeh 0.12.1 with Django 1.9.8.
> 
> > I’m running an app with  
> > bokeh serve emptydetails\_graph.py
> 
> > ``
> 
> > 
> 
> > 
> 
> > Let’s say the emptydetails\_graph.py running on the bokeh server is this:
> 
> > ```auto
> > from bokeh.plotting import figure, show, output_server
> > 
> > p = figure(title="Server Plot")
> > p.circle([1, 2, 3], [4, 5, 6])
> > 
> > output_server("hover")
> > 
> > show(p)
> > 
> > ```
> 
> > 
> 
> > I would like to pass an argument from Django to start a new session similar to this:
> 
> > 
> 
> > ```auto
> > from bokeh.plotting import figure, show, output_server
> > p = figure(title= **STRING PARAMETER FROM DJANGO** )
> > p.circle([1, 2, 3], [4, 5, 6])
> > 
> > output_server("hover")
> > 
> > show(p)
> > 
> > ```
> 
> > Obviously my use case is different, the main goal being I would like to pass a string from Django to a Bokeh App, when creating a new session.
> 
> > ```auto
> > the_script = autoload_server(model=None,app_path='/emptydetails_graph',url="[http://127.0.0.1:5006/](http://127.0.0.1:5006/)", **STRING PARAMETER HERE** )
> > 
> > ```
> 
> > ```auto
> > How would I do this?
> > 
> > ```

---

<div class="post-metadata">

**Author:** ![Bryan](https://discourse.bokeh.org/user_avatar/discourse.bokeh.org/bryan/32/3625_2.png) [@Bryan](https://discourse.bokeh.org/u/Bryan)\
**Post date:** [September 13, 2016, 4:45pm UTC](https://discourse.bokeh.org/t/bokeh-html-requests-advice/1567/3 "2016-09-13T16:45:44Z")

</div>

Richard,

That section only applies to bokeh apps run directly on the bokeh server, i.e., run as:

&nbsp;&nbsp;bokeh serve myapp.py

Then in your autoload call, you could add custom HTML request arguments to the app\_path, and when the session is created for that autoload call.

Please not output\_server is very limited inherently, and I just opened an issue to discuss deprecating/removing it. A newar identical question was on this list earlier today, please see my longer response there:

&nbsp;&nbsp;[Redirecting to Google Groups](https://groups.google.com/a/continuum.io/forum/?pli=1#!topic/bokeh/QNFpo8r0gf8)

Thanks,

Bryan

> **···**
>
> > On Sep 13, 2016, at 11:33 AM, Robbie Pritchard \<rpritchard@ordinalscience.com\> wrote:
> > 
> > I read throught the docs and found this [Bokeh server — Bokeh 3.3.2 Documentation](http://bokeh.pydata.org/en/latest/docs/user_guide/server.html#accessing-the-http-request) whcih would tell me that my bokeh app should include:  
> > imports
> > 
> > args = curdoc().session\_context.request.arguments
> > 
> > p = figure(title=string(args.get('Name')[0])  
> > p.circle([1, 2, 3], [4, 5, 6])
> > 
> > output\_server("hover")
> > 
> > show(p)
> > 
> > yet I am still confused on how to set the arguments with autoload\_server  
> > the\_script = autoload\_server(model=None,app\_path='/emptydetails\_graph',url="[http://127.0.0.1:5006/&quot;\](http://127.0.0.1:5006/&quot;%5C))
> > 
> > On Tuesday, September 13, 2016 at 10:33:20 AM UTC-5, Robbie Pritchard wrote:  
> > I'm currently running Bokeh 0.12.1 with Django 1.9.8.
> > 
> > I'm running an app with  
> > bokeh serve emptydetails\_graph.py
> > 
> > Let's say the emptydetails\_graph.py running on the bokeh server is this:  
> > from bokeh.plotting import figure, show, output\_server
> > 
> > p = figure(title="Server Plot")  
> > p.circle([1, 2, 3], [4, 5, 6])
> > 
> > output\_server("hover")
> > 
> > show(p)
> > 
> > I would like to pass an argument from Django to start a new session similar to this:
> > 
> > from bokeh.plotting import figure, show, output\_server
> > 
> > p = figure(title=STRING PARAMETER FROM DJANGO)  
> > p.circle([1, 2, 3], [4, 5, 6])
> > 
> > output\_server("hover")
> > 
> > show(p)  
> > Obviously my use case is different, the main goal being I would like to pass a string from Django to a Bokeh App, when creating a new session.  
> > the\_script = autoload\_server(model=None,app\_path='/emptydetails\_graph',url="[http://127.0.0.1:5006/&quot;](http://127.0.0.1:5006/&quot;), STRING PARAMETER HERE)
> > 
> > How would I do this?
> > 
> > --  
> > 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 bokeh+unsubscribe@continuum.io.  
> > To post to this group, send email to bokeh@continuum.io.  
> > To view this discussion on the web visit [https://groups.google.com/a/continuum.io/d/msgid/bokeh/a0113d8c-4c9a-4950-a876-e2e7c6070eaf%40continuum.io\](https://groups.google.com/a/continuum.io/d/msgid/bokeh/a0113d8c-4c9a-4950-a876-e2e7c6070eaf%40continuum.io%5C).  
> > For more options, visit [https://groups.google.com/a/continuum.io/d/optout\](https://groups.google.com/a/continuum.io/d/optout%5C).

---

<div class="post-metadata">

**Author:** ![Robbie\_Pritchard](https://discourse.bokeh.org/letter_avatar_proxy/v4/letter/r/bc8723/32.png) [@Robbie\_Pritchard](https://discourse.bokeh.org/u/Robbie_Pritchard)\
**Post date:** [September 13, 2016, 4:55pm UTC](https://discourse.bokeh.org/t/bokeh-html-requests-advice/1567/4 "2016-09-13T16:55:07Z")

</div>

Oh sorry about that. this app is currently running on  
bokeh serve myapp.py

``

I just picked a random sample app to illustrate the problem of pushing the argument to bokeh. my app doesn’t use output\_server().

would this be the right?

the\_script = autoload\_server(model=None,app\_path=’/myapp\*\*?name=“company\_name”\*\*’,url=“[http://127.0.0.1:5006/](http://www.google.com/url?q=http%3A%2F%2F127.0.0.1%3A5006%2F&sa=D&sntz=1&usg=AFQjCNHMjWk45cHNYQ-2-qbfsm6VukrK9g)”)

and then access it with:

```auto
args = curdoc().session_context.request.arguments

```

```auto

name = **string(args.get('name')[0]**)

``

Thanks for the help!

<details class='elided'>
<summary title='Show trimmed content'>&#183;&#183;&#183;</summary>

On Tuesday, September 13, 2016 at 11:45:47 AM UTC-5, Bryan Van de ven wrote:
> Richard,
> 
> 
> 
> That section only applies to bokeh apps run directly on the bokeh server, i.e., run as:
> 
> 
> 
> bokeh serve myapp.py
> 
> 
> 
> Then in your autoload call, you could add custom HTML request arguments to the app_path, and when the session is created for that autoload call.
> 
> 
> Please not output_server is very limited inherently, and I just opened an issue to discuss deprecating/removing it. A newar identical question was on this list earlier today, please see my longer response there:
> 
> 
> 
> [https://groups.google.com/a/continuum.io/forum/?pli=1#!topic/bokeh/QNFpo8r0gf8](https://groups.google.com/a/continuum.io/forum/?pli=1#!topic/bokeh/QNFpo8r0gf8)
> 
> 
> 
> Thanks,
> 
> 
> 
> Bryan
> 
> 
> 
> 
> > On Sep 13, 2016, at 11:33 AM, Robbie Pritchard <rprit...@ordinalscience.com> wrote:
> 
> >
> > I read throught the docs and found this [http://bokeh.pydata.org/en/latest/docs/user_guide/server.html#accessing-the-http-request](http://bokeh.pydata.org/en/latest/docs/user_guide/server.html#accessing-the-http-request) whcih would tell me that my bokeh app should include:
> 
> > imports
> 
> >
> > args = curdoc().session_context.request.arguments
> 
> >
> >
> >
> > p = figure(title=string(args.get('Name')[0])
> 
> > p.circle([1, 2, 3], [4, 5, 6])
> 
> >
> >
> >
> > output_server("hover")
> 
> >
> >
> >
> > show(p)
> 
> >
> > yet I am still confused on how to set the arguments with autoload_server
> 
> > the_script = autoload_server(model=None,app_path='/emptydetails_graph',url="[http://127.0.0.1:5006/](http://127.0.0.1:5006/)")
> 
> >
> >
> >
> >
> > On Tuesday, September 13, 2016 at 10:33:20 AM UTC-5, Robbie Pritchard wrote:
> > I'm currently running Bokeh 0.12.1 with Django 1.9.8.
> 
> >
> > I'm running an app with
> > bokeh serve emptydetails_graph.py
> 
> >
> >
> > Let's say the emptydetails_graph.py running on the bokeh server is this:
> 
> > from bokeh.plotting import figure, show, output_server
> 
> >
> >
> >
> > p = figure(title="Server Plot")
> 
> > p.circle([1, 2, 3], [4, 5, 6])
> 
> >
> >
> >
> > output_server("hover")
> 
> >
> >
> >
> > show(p)
> 
> >
> > I would like to pass an argument from Django to start a new session similar to this:
> 
> >
> > from bokeh.plotting import figure, show, output_server
> 
> >
> >
> >
> > p = figure(title=STRING PARAMETER FROM DJANGO)
> 
> > p.circle([1, 2, 3], [4, 5, 6])
> 
> >
> >
> >
> > output_server("hover")
> 
> >
> >
> >
> > show(p)
> 
> > Obviously my use case is different, the main goal being I would like to pass a string from Django to a Bokeh App, when creating a new session.
> 
> > the_script = autoload_server(model=None,app_path='/emptydetails_graph',url="[http://127.0.0.1:5006/](http://127.0.0.1:5006/)", STRING PARAMETER HERE)
> 
> >  
> 
> > How would I do this?
> >
> > --
> > 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 bokeh+un...@continuum.io.
> 
> > To post to this group, send email to bo...@continuum.io.
> 
> > To view this discussion on the web visit [https://groups.google.com/a/continuum.io/d/msgid/bokeh/a0113d8c-4c9a-4950-a876-e2e7c6070eaf%40continuum.io](https://groups.google.com/a/continuum.io/d/msgid/bokeh/a0113d8c-4c9a-4950-a876-e2e7c6070eaf%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>
```

---

<div class="post-metadata">

**Author:** ![system](https://discourse-uploads.bokeh.org/original/2X/1/14eb24f9e10e4e9b78e3f10f66c04ffa96446e5a.svg) [@system](https://discourse.bokeh.org/u/system)\
**Post date:** [July 21, 2021, 9:09pm UTC](https://discourse.bokeh.org/t/bokeh-html-requests-advice/1567/5 "2021-07-21T21:09:34Z")

</div>


