Metadata-Version: 2.1
Name: streamlit-url-fragments
Version: 0.1.0
Summary: Get the URL fragment(s) (part after #) from Streamlit
License: Apache-2.0
Author: Tomasz Kontusz
Author-email: tomasz.kontusz@gmail.com
Requires-Python: >=3.8,<4.0
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Dist: importlib-resources (>=5.4.0,<6.0.0)
Requires-Dist: streamlit (>0.63)
Description-Content-Type: text/markdown

# Streamlit URL fragment

Get the URL fragment (the part of URL after #) in your Streamlit script:

```python
import streamlit as st
from streamlit_url_fragments import get_fragments

current_value = get_fragments()
st.write(f"Current value: {get_fragments()}")
```

Warning: the first value you'll get will be a `None` - that means the component is still loading.
You can wait for the correct value with `if current_value is None: st.stop()`.

This fork adds the ability to get the hash as a dictionary if it is in the correct format.
Please make sure to test the type returned by the function before using it.

```python
import streamlit as st
from streamlit_url_fragments import get_fragments

current_value = get_fragments()

if isinstance(current_value, dict):
    st.write("The function returned a dictionary.")
elif isinstance(current_value, str):
    st.write("The function returned a string.")
else:
    st.write(f"The function returned an unexpected type: {type(current_value)}")

st.write(f"Current value: {current_value}")
```
