I am currently using Streamlit to develop a web application with Python. In my application, I make few HTTP POST requests using the requests library. Specifically, I use the following code to send a POST request:
While this code executes without issues, I am unable to inspect the details of these HTTP requests in the network tab of my browser’s developer tools. I would like to understand the process for viewing these requests.
Debugging Information:
Running Environment: The app is running locally.
Hosting Platform: N/A (app is not deployed yet).
GitHub Repository: :none
Error Message: There is no error message displayed; the issue is that the requests are not visible in the network tab of the developer tools.
Versions:
Streamlit version: 1.36.0
Python version: 3.9.13
Could you please provide guidance on how I can view and inspect these HTTP requests? Is there a specific configuration or method I need to use within Streamlit to ensure these requests are visible in the network tab?
Those requests are being executed by python, not by the website itself (i.e. not by html or javascript), so they will not be displayed in the developer tools at all.
The only exception I can think of is if you embedded javascript into your app, or ran your app via stlite so that it’s entirely running in the browser, and not running in python at all.
I am currently developing a web application using Streamlit and have some concerns regarding the privacy and security of the data processed within my application. Specifically, I am using Streamlit’s input fields to collect user credentials and storing authentication tokens in st.session_state.
Here is a snippet of the code I am using:
import streamlit as st
import requests
st.title("Login")
def login(email, password):
loginPayload = {
"email": email,
"password": password
}
response = requests.post(f"{urls.api_url}{PathType.LOGIN.value}", json=loginPayload)
if response.status_code == 200:
return response.json(), True
else:
return None, False
with st.form("login_form"):
email = st.text_input("Email")
password = st.text_input("Password", type="password")
login_button = st.form_submit_button("Login")
if login_button:
token, success = login(email, password)
if success:
st.session_state.token = token['token']
st.success("Login successful")
else:
st.error("Login failed. Please check your credentials.")
Is there any chance that Streamlit (or Snowflake, Inc.) has access to the information entered in these input fields or stored in st.session_state?
Does Streamlit collect or store any data entered or processed in my Streamlit application by default?
Are there any additional measures I should take to ensure that the data processed within my application remains private and secure?
I appreciate your assistance in clarifying these points to ensure that I am complying with best practices for data privacy and security in my application.
For 3, it really depends what you’re doing with that information, how you’re storing it, etc. For example, you should make sure that whatever service you’re sending the request.post to doesn’t leak the information.