Execute Python code in client side and return result

Hi, may I know if there any way to Execute Python code in client side and return result? Thanks.

Hi @gegreg -

Can you be more specific to what you are trying to achieve? What does “client side” mean in this context that is different than how Streamlit normally works?


Hi Randy,
Thanks for replying me!
What I am trying to do is to get Windows username by using os.getlogin(). However, when I use this function, it only return the username of my hosting server and not client’s username.

Thank you!

This is the expected behavior. When you are developing locally, the hostname is the same is your network. But from a security perspective, a user accessing your app from their local computer wouldn’t want to be transmitting sensitive information like that.

That’s where authentication solutions come into play, whether it’s something simple as a user/password text input, OAuth, Okta, Active Directory, etc. Which one is appropriate for you depends on your company requirements.