i was able to extract fragments using streamlit-url-fragment module in streamlit version 1.8.1 but unable to do the same in ver 1.14.1.
This is happening due to auto refresh that is happening in browser address bar and removing url fragments automatically.
Steps to reproduce
Try Passing URL fragments for example below -
127.0.0.0:8051/#access_token=XYZ&token_type=Bearer
Hi @Caroline,
Thank you for looking into the issue, please find the code snippet below -
import streamlit as st
from streamlit_url_fragment import get_fragment
if __name__ == "__main__":
# -- Header Information
logger.info("Loading page configurations")
st.set_page_config(
page_title='Page 1',
page_icon='./images/xyz.png',
layout='centered',
initial_sidebar_state='auto')
current_value = get_fragment()
if current_value is None:
st.stop():
print("current_value", current_value)
Here i am trying to extract # fragments from the url.
Sample URL - 127.0.0.0:8051/#access_token=XYZ&token_type=Bearer
Is there a reason youβre using 1.14 rather than the most recent release? Also, please check out our guide on posting questions and update your code snippet to be formatted properly.
@Caroline - I tried it with the most recent Streamlit version also, but was facing the same issue.
Were you able to reproduce the issue i explained?
Quick Question - is there a way to get Request URL in Streamlit ?
Weβve experienced the same issue. We need to get a token from the fragment, but unfortunately anything after the # in the url is removed when the page loads.
Unfortunately even after many attempts we were unable to fix it, and so we had to reverted back to 1.9, which is the latest version without the issue.
@dclin Same for me as for @Ketan_Sharma, our token retrieval only supports returning the token as a fragment, not as a query param. Unfortunately there seems to be no way to disable Streamlit from removing the fragments.