I used python flask function send_file to send image file from server to client. I get Http 200 response from the server with headers containing content information and response.text returns string of bytes. Currently both server and client is in local system. I want to access the file and save it in client side. Server code:
@app.route("/ss", methods=["POST"])
def ss():
return send_file("chap.jpg",attachment_filename="chap.jpg")
Client code:
payload = {"image": image}
r = requests.post(http://127.0.0:5000/ss, files=payload)
print(r.text)
I tried converting the string from r.text to numpy array and save the array as jpg but i get TypeError for bad argument.