Skip to main content

Get the URL fragment(s) (part after #) from Streamlit

Project description

Streamlit URL fragment

A fork of ktosiek/streamlit-url-fragment that adds the ability to get the hash as a dictionary if it is in the correct format.

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

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.

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}")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

streamlit_url_fragments-0.1.1.tar.gz (676.6 kB view details)

Uploaded Source

Built Distribution

streamlit_url_fragments-0.1.1-py3-none-any.whl (687.4 kB view details)

Uploaded Python 3

File details

Details for the file streamlit_url_fragments-0.1.1.tar.gz.

File metadata

File hashes

Hashes for streamlit_url_fragments-0.1.1.tar.gz
Algorithm Hash digest
SHA256 471afbba86dea6d9695a3ca6ae36b4d301606b92992304d955fb84dcdc6530ef
MD5 b1c4024d5f7a0b5ae0067fbd8c6dc7e6
BLAKE2b-256 171700154df310388d3a0c8e5f38694c2d5e7216d333ce06a2e1daa9479801f1

See more details on using hashes here.

File details

Details for the file streamlit_url_fragments-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for streamlit_url_fragments-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9a83fcfceb23651bc79412cca60d96fd9b0d75a784fab04a1178d108d08420f4
MD5 949732de9923ba65162f5b3a3e4526e7
BLAKE2b-256 b313e69278a4c5a277b122aeb72ffe000b216dd6de350cf84623274e6ee83a01

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page