Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Day 23 update #13

Open
SeryioGonzalez opened this issue Jan 26, 2024 · 0 comments
Open

Day 23 update #13

SeryioGonzalez opened this issue Jan 26, 2024 · 0 comments

Comments

@SeryioGonzalez
Copy link

SeryioGonzalez commented Jan 26, 2024

st.experimental_get_query_params has been updated to get_query_params. There are some minor code updates. Please use:

import streamlit as st

st.title('st.query_params')

with st.expander('About this app'):
  st.write("`st.query_params` allows the retrieval of query parameters directly from the URL of the user's browser.")

# 1. Instructions
st.header('1. Instructions')
st.markdown('''
In the above URL bar of your internet browser, append the following:
`?firstname=Jack&surname=Beanstalk`
after the base URL `http://share.streamlit.io/dataprofessor/st.query_params/`
such that it becomes 
`http://share.streamlit.io/dataprofessor/st.query_params/?firstname=Jack&surname=Beanstalk`
''')


# 2. Contents of st.query_params
st.header('2. Contents of st.query_params')
st.write(st.query_params.to_dict())


# 3. Retrieving and displaying information from the URL
st.header('3. Retrieving and displaying information from the URL')

firstname = st.query_params.get_all('firstname')[0]
surname = st.query_params.get_all('surname')[0]

st.write(f'Hello **{firstname} {surname}**, how are you?')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant