Are API requests in streamlit done server-side or client side?
I am using the st_supabase_connection library in my streamlit app. I am wondering if the network requests to supabase are visible from the client, or if they happen server side. Will they be able to see the secret key stored in the secrets.toml file by inspecting network traffic in chrome dev tools, for example?
This could extend to other 3rd party REST APIs as well — will the secrets be seen when inspecting network traffic on the client’s browser, or are these requests happening server side?
Ok, for clarity’s sake, when running a basic script like this…
import streamlit as st
import requests
# Load the secret URL from Streamlit secrets
url = st.secrets["api"]["url"]
# Streamlit app
st.title("Basic Streamlit App with GET Request")
# Button to make the GET request
if st.button("Get Data"):
try:
response = requests.get(url)
response.raise_for_status() # Raise an error for bad status codes
data = response.json()
st.write("Data fetched successfully:", data)
except requests.exceptions.RequestException as e:
st.error(f"Error fetching data: {e}")
The request will run on the server and be hidden from the browser?
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.