I am new to streamlit (and toml files!). Working on an app locally on my machine. This uses an API to geocode postcodes. Rather than have the user enter the API into a text input field, I’d like to make use of st.secrets. I have set up a toml file from windows text editor (this is saved with .txt extension, how do I save with .toml extension?). I have put the secrets.toml file within a folder called .streamlit which itself is within a folder containing main.py (the streamlit app file). Despite following the structure, I am getting FileNotFoundError. Would really appreciate a steer to resolve this, thanks.
my folder structure is:
main.py (streamlit app)
secrets.toml (saved as txt file though)
I run st.write(st.secrets[‘api_key’]) in main.py, but this prompts the file not found error. I was expecting this to print my api key to the screen (as a test, wont be keeping that line!).
- Streamlit version: 1.24.0
- Python version: 3.8.13
- Using Conda
- OS version: windows 11 enterprise
- Browser version: edge 114.0.1823.79
I’m not 100% sure on how to go about creating a toml file so may have done this incorrectly - the process I went about was to open a text file, add in api key using the format from the toml website (e.g. api_key = “some_api_key”, and save-as secrets.toml in the above location.