L iVddlmZddlmZddlmZddlmZddlm Z ddl m Z ddl m Z ddlmZmZmZe d dd Ze d dd Z dd Z ddZ ddZy)) annotations)Any)parse)StreamlitAPIException) ForwardMsg)gather_metrics)get_script_run_ctx)EMBED_OPTIONS_QUERY_PARAMEMBED_QUERY_PARAMEMBED_QUERY_PARAMS_KEYSexperimental_get_query_paramsct}|iS|jttj|j dt S)asReturn the query parameters that is currently showing in the browser's URL bar. Returns ------- dict The current query parameters as a dict. "Query parameters" are the part of the URL that comes after the first "?". Example ------- Let's say the user's web browser is at `http://localhost:8501/?show_map=True&selected=asia&selected=america`. Then, you can get the query parameters using the following: >>> import streamlit as st >>> >>> st.experimental_get_query_params() {"show_map": ["True"], "selected": ["asia", "america"]} Note that the values in the returned dict are *always* lists. This is because we internally use Python's urllib.parse.parse_qs(), which behaves this way. And this behavior makes sense when you consider that every item in a query string is potentially a 1-element array. Tkeep_blank_valueskeys_to_exclude)r #mark_experimental_query_params_used_exclude_keys_in_dictrparse_qs query_stringr )ctxs r/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/streamlit/commands/experimental_query_params.pyget_query_paramsrsF6  C { ++-  s''4@/ experimental_set_query_paramsc t}|y|jt}t||j|j _|j j|_|j |y)adSet the query parameters that are shown in the browser's URL bar. .. warning:: Query param `embed` cannot be set using this method. Parameters ---------- **query_params : dict The query parameters to set, as key-value pairs. Example ------- To point the user's web browser to something like "http://localhost:8501/?show_map=True&selected=asia&selected=america", you would do the following: >>> import streamlit as st >>> >>> st.experimental_set_query_params( ... show_map=True, ... selected=["asia", "america"], ... ) N)r rr_ensure_no_embed_paramsrpage_info_changedenqueue) query_paramsrmsgs rset_query_paramsr"Esg6  C {++- ,C)@c&&*C&,,99CKKrc||jDcic]\}}|j|vs||c}}Scc}}w)z?Returns new object but without keys defined in keys_to_exclude.)itemslower)drkeyvalues rrrms< &'WWY !sE#))+_2TU   s88c |Dcgc]G}|j|k(r2|j|r!||Dcgc]}|jc}Ic}}Dchc]}|D]}|jc}}Scc}wcc}}wcc}}w)zWExtracts key (case-insensitive) query params from Dict, and returns them as Set of str.)r%get)r param_keyr'r(sublistitems r_extract_key_query_paramsr.vs$ yy{i'L,<,r:r>) __future__rtypingrurllibrstreamlit.errorsrstreamlit.proto.ForwardMsg_pb2rstreamlit.runtime.metrics_utilr7streamlit.runtime.scriptrunner_utils.script_run_contextr $streamlit.runtime.state.query_paramsr r r rr"rr.rrrrHs#259V/0"1"J/0$1$N(1 & 36   $ ,$