This is an experimental feature. Experimental features and their APIs may change or be removed at any time. To learn more, click here.

Return the query parameters that is currently showing in the browser's URL bar.

Function signature[source]




The current query parameters as a dict. "Query parameters" are the part of the URL that comes after the first "?".


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

{"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.


Still have questions?

Our forums are full of helpful information and Streamlit experts.

Was this page helpful?

editEdit this page on GitHub