Deep Links In Streamlit?

Does anyone have any recommendations on implementing deep links into a streamlit app? So that when a user with a link navigates to something like “www.mystreamlitapp.com/economics”, streamlit would acknowledge and reconfigure the dashboard accordingly?

Hi @theimposingdwarf, welcome to the Streamlit community!

Work towards the functionality you are describing I believe is covered with this recently merged PR:

The idea here is that you can pass a URL that has the default values of widgets, so the app is in a specific state when you send the link to someone. It hasn’t made it into a full release of Streamlit yet, but you can test it out by installing a recent nightly version:

pip install streamlit-nightly

If you do end up testing this, we’d love to know your experience, as this will help us refine the experience into the stable codebase.

Best,
Randy

1 Like

Nice! This looks very capable.

I tried the most recent nightly build but none of the streamlit commands/functions were recognized in either the terminal or in my script. The build installed and would import without errors, there just seems to be nothing to it.

I tried the previous day’s nightly build and the st.experimental_get_query_params() works just fine at grabbing the information out of my custom typed URL.

The st.experimental_set_query_params() doesn’t appear to work. The documentation says it’s looking for a dict object as input but when I actually tried to hand the function the dict, a typeError is thrown,

experimental_set_query_params() takes 0 positional arguments but 1 was given

Not really sure what’s going on… the function definition says it’s looking for **query_params.

2 Likes

Thanks for flagging that. I haven’t had a chance to try this yet, but if you’re sure it doesn’t work, please feel free to open a GitHub issue (or, wait a day or two until I can try it :slight_smile:)