Sending data from Bokeh to Flask

I have a simple flask app that displays a bokeh scatter plot. I would like to select a data point using the taptool and send information about the selected point back to flask so that it takes an action. Is this possible?

The following example shows how to embed bokeh into flask and send data from flask to bokeh (https://github.com/bokeh/bokeh/tree/master/examples/embed/simple). However, is it possible to do it the other way around, i.e., send data from bokeh back to flask?

Any help/examples are appreciated.

Thanks.

I don't have an example handy, but to do this with a CustomJS callback, I think you would have to do the following:

* add an endpoint to your Flask app for clients to post AJAX update calls to
* have the callback make the AJAX call to the Flask app to send whatever data to

If you are successful along these lines, and could make a minimal prototype to contribute as an example in a Pull Request, I think it would be appreciated by quite a few other users.

Thanks,

Bryan

···

On Jun 15, 2016, at 9:20 PM, [email protected] wrote:

I have a simple flask app that displays a bokeh scatter plot. I would like to select a data point using the taptool and send information about the selected point back to flask so that it takes an action. Is this possible?

The following example shows how to embed bokeh into flask and send data from flask to bokeh (https://github.com/bokeh/bokeh/tree/master/examples/embed/simple\). However, is it possible to do it the other way around, i.e., send data from bokeh back to flask?

Any help/examples are appreciated.

Thanks.

--
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/e51e3496-543a-408a-aaf8-25ce24a031da%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

I wonder if long term, it would be possible to simply the process of integrating bokeh into flask. I don’t have a good idea for how.

Another option, would be to just create simple bokeh additions that alleviate a lot of the need for a web framework.

For instance, R-shiny has the ability to store users and log in info in a DB or a csv file, so access to an app can be segregated and there can be some minimal authentication layer. Google auth is a possibility and simple templates can be used to give shiny dashboards a single page web app feel.

I know in 0.12 there will be custom single page templates correct? This will be a big step forward. Would be nice if we could handle auth and segregated data access in a simple way as well. Even google auth would be a huge win in my book.

···

On Wed, Jun 15, 2016 at 10:25 PM, Bryan Van de Ven [email protected] wrote:

I don’t have an example handy, but to do this with a CustomJS callback, I think you would have to do the following:

  • add an endpoint to your Flask app for clients to post AJAX update calls to

  • have the callback make the AJAX call to the Flask app to send whatever data to

If you are successful along these lines, and could make a minimal prototype to contribute as an example in a Pull Request, I think it would be appreciated by quite a few other users.

Thanks,

Bryan

On Jun 15, 2016, at 9:20 PM, [email protected] wrote:

I have a simple flask app that displays a bokeh scatter plot. I would like to select a data point using the taptool and send information about the selected point back to flask so that it takes an action. Is this possible?

The following example shows how to embed bokeh into flask and send data from flask to bokeh (https://github.com/bokeh/bokeh/tree/master/examples/embed/simple). However, is it possible to do it the other way around, i.e., send data from bokeh back to flask?

Any help/examples are appreciated.

Thanks.

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/e51e3496-543a-408a-aaf8-25ce24a031da%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

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/B8C22D6F-5D4E-4BD8-ABAB-15213BD85142%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Yes, Bokeh server recently added support for an index.html template, so it is possible to serve "bokeh-centric" SPAs directly from the Bokeh server.

Regarding auth, it's really outside my area of expertise, so suggestions are welcome, tho any auth addition would need to be optional, and probably extensible.

Bryan

···

On Jun 15, 2016, at 10:17 PM, Jordan Bramble <[email protected]> wrote:

I wonder if long term, it would be possible to simply the process of integrating bokeh into flask. I don't have a good idea for how.

Another option, would be to just create simple bokeh additions that alleviate a lot of the need for a web framework.

For instance, R-shiny has the ability to store users and log in info in a DB or a csv file, so access to an app can be segregated and there can be some minimal authentication layer. Google auth is a possibility and simple templates can be used to give shiny dashboards a single page web app feel.

I know in 0.12 there will be custom single page templates correct? This will be a big step forward. Would be nice if we could handle auth and segregated data access in a simple way as well. Even google auth would be a huge win in my book.

On Wed, Jun 15, 2016 at 10:25 PM, Bryan Van de Ven <[email protected]> wrote:
I don't have an example handy, but to do this with a CustomJS callback, I think you would have to do the following:

* add an endpoint to your Flask app for clients to post AJAX update calls to
* have the callback make the AJAX call to the Flask app to send whatever data to

If you are successful along these lines, and could make a minimal prototype to contribute as an example in a Pull Request, I think it would be appreciated by quite a few other users.

Thanks,

Bryan

> On Jun 15, 2016, at 9:20 PM, [email protected] wrote:
>
> I have a simple flask app that displays a bokeh scatter plot. I would like to select a data point using the taptool and send information about the selected point back to flask so that it takes an action. Is this possible?
>
> The following example shows how to embed bokeh into flask and send data from flask to bokeh (https://github.com/bokeh/bokeh/tree/master/examples/embed/simple\). However, is it possible to do it the other way around, i.e., send data from bokeh back to flask?
>
> Any help/examples are appreciated.
>
> Thanks.
>
>
> --
> 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/e51e3496-543a-408a-aaf8-25ce24a031da%40continuum.io\.
> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
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/B8C22D6F-5D4E-4BD8-ABAB-15213BD85142%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
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/CAB%3DGhatYKjfrS7iayYsOmDdAkzs_ZTDhK4B_fth%3D8RdEOj7YGQ%40mail.gmail.com\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.