user_info = json.dumps({"bio":biography, "interests":interest_indexes})
headers = {'Content-type':'application/json'}
url = "http://0.0.0.0:5000/users/" + str(user_id)
r = requests.post("http://0.0.0.0:5000/users/1", data=user_info, headers=headers)
I've enabled logging and this is in Flask. If I manually do a POST request to the URL with the correct JSON response body, it works fine. It just says INFO:requests.packages.urllib3.connectionpool:Starting new HTTP connection (1): 0.0.0.0
And it just hangs there forever.
Any ideas?
You need to run your flask app with threading enabled.
app.run(threaded=True)
This is not advisable for production of course, just for quick development :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With