I'm having trouble getting the Python requests
module to post to an endpoint on the same server.
The server is running flask, and the route I want to post to is /new_applet
.
My code is below. It is inside a different flask route function, which could be an issue?
url = "http://0.0.0.0:5000/new_applet"
data = {
"action": "add",
"plugin": plugin,
"version": version,
"component": component
}
resp = requests.post(url, data=data)
However it hangs while trying to make the post request. Debugging shows that the request never reaches the flask route function.
The request works if I run the following command on the server:
curl --location --request POST '0.0.0.0:5000/new_applet' \
--form 'action=add' \
--form 'plugin=up_spotify' \
--form 'version=0.1' \
--form 'component=inputs'
Why doesn't the Python request work, when the curl
request does?