I'm trying to request to my flask webserver with an image using python and just can't get it to work.
Using cURL it's simple:
curl -XPOST -F "file=@image.jpg" http://127.0.0.1:5001
But in python using my code:
import requests
with open("image.jpg", "rb") as a_file:
file_dict = {"image.jpg": a_file}
response = requests.post("http://127.0.0.1:5001", files=file_dict)
print(response.text)
print(response.status_code)
I simply get the HTML of the site returned and status 200. Not the JSON that returns using cURL (and is what I want returned).
Any help would be appreciated, Thanks.