Still learning but can someone explain to change the deprecated ‘experimental_get_query_params’ to ‘query_params’ simply?
If I change this:
if 'code' not in st.experimental_get_query_params():
show_auth_link(config, label)
code = st.experimental_get_query_params()['code'][0]
state = st.experimental_get_query_params()['state'][0]
to this:
if 'code' not in st.query_params():
show_auth_link(config, label)
code = st.query_params()['code'][0]
state = st.query_params()['state'][0]
I see this error: TypeError: ‘QueryParamsProxy’ object is not callable
prior to this code change I did from this which is ALSO throwing an error:
From this:
st.experimental_set_query_params(**qparms)
To this:
st.query_params["key"] = qparms
I see the error:
StreamlitAPIException : You cannot set a query params key key to a dictionary.
When you switch from st.experimental_get_query_params() to st.query_params , you need to adjust how you access the properties. st.query_params is no longer a method (callable) but a property (non-callable) that returns a dictionary-like object of the current session’s query parameters.
if 'code' not in st.session_state.query_params:
show_auth_link(config, label)
code = st.session_state.query_params['code'][0]
state = st.session_state.query_params['state'][0]
The correct approach after the API change is:
query_params = st.experimental_get_query_params() # This is the old way
if 'code' not in st.query_params:
show_auth_link(config, label)
code = st.query_params['code'][0]
state = st.query_params['state'][0]
Hope this helps!
Kind Regards,
Sahir Maharaj
Data Scientist | AI Engineer
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.