I have built an app using Streamlit to show some graphs. In this app, I am collecting some small data from external source and then plot them. In there any facility by Streamlit to share the raw data using REST API, then others can use data?
Sure! You can call an API with any handy library – requests is the most popular choice.
import requests import streamlit as st data = requests.get("'https://jsonplaceholder.typicode.com/todos/1'").json() st.write(data)
Sorry, but what I mean by that was that, how I can use Streamlit as REST API.
In summary, I collect some data from external sources (like what you said) and I plot them by any library. In addition, I want to share these raw data for others(developers or researchers) so, they can analyze data in their own way. I want something like FastAPI to share it among others but I do not know how I can use it alongside Streamlit.
Ah, I see. No, there is not currently any way for Streamlit to also provide a REST API, unfortunately. That is definitely something we may consider adding in the future, but it’s not possible currently.
Thank you for this discussion!
FWIW, I also think a REST API would be useful. For example, I’d like to write monitors that check if my streamlit apps are functioning well. So far, I haven’t figured out a way to do this. An API interface would be a great solution for this, and I think it would have lots of other use cases, as well.