I run a streamlit app and it processes some records based on client/user input. I want to log ip address of client/user and records processed by that user. Can you help please?
Do you need IP addresses specifically? In general, you can log any records by posting them to another service, passing them to a DB, whatever you want really as that’s just plain python. The tricky bit will be getting access to the client IP address. There’s no API for that currently (afaik, issue is still open https://github.com/streamlit/streamlit/issues/602).
What’s the problem you’re trying to solve?
Some other options -
- Use something the user enters into the page (name, id, etc)
- Investigate getting hold of the ReportSession object to get an ID of the current session https://gist.github.com/tvst/036da038ab3e999a64497f42de966a92 and https://github.com/streamlit/streamlit/blob/844691d0b15e0f3622a1fb97b34e4eae4161fe3f/lib/streamlit/ReportSession.py#L54 would be starting points I think
Thanks for your response.
Actually, I am using streamlit for deployment of my ml model that predict class of client records.
I want to log, which client ip has accessed my app for processing how many records.
But I am unable to make correspondence between client IP and number of records processed by my model in his respective session.
Please help me with this.
Regards
I do not think you can get the IP address without modifying the streamlit project itself. I’ve put some pointers to where you may want to try and deal with this if you need to go down that route.
Otherwise the main other option is to rely on something that the user enters into the app (e.g. usernames and passwords). Whether this works for you will depend on your users and why you need to associate IP addresses with them.
Hi,
Can I use use custom widget like widget from https://www.revolvermaps.com/ or ipigence.com in streamlit.
Kindly help to code
Sir,
I found everywhere written that following code is working.
m = folium.Map(location=[45.5236, -122.6750])
st.write(m.repr_html(), unsafe_allow_html=True)
I tried on my windows as well as linux, but it is not working and I am unable to find solution. Can you help?
Here’s a recent discussion on getting IP addresses