Post request in Streamlit

My app is relient on API calls. The app gets all the data from API calls that are “get” requests, but fails at the “post” request, where I get the error:
KeyError: This app has encountered an error. The original error message is redacted to prevent data leaks. Full error details have been recorded in the logs (if you’re on Streamlit Cloud, click on ‘Manage app’ in the lower right of your app).

Is it possible to run post requests on a share streamlit app?

Cheers,
Christian

@C-Roensholt Yes, it is possible to make post requests. It’s difficult to know what sort of error it might be, but most likely the post request is failing from some sort of error unrelated to streamlit.

Some example code that works fine:

import requests
import streamlit as st

if st.button("Make post request"):
    st.write(requests.post("https://httpbin.org/post").json())

Could you post the code, or some equivalent code, that is failing?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.