Question

I have an endpoint that must send an image in the response. The original image is a file in the server that I open with python (open().read()) and save it in the NDB as BlobProperty (ndb.BlobProperty()).

My protoRPC message is a BytesField.

If I go in the apis-explorer the picture comes with the correct value, but it doesn't work in my JS Client. I've been trying to just read the file, encode and decode base64 but the JS is still not recognizing it. Does anyone have an idea how to solve it? How can I send the base64 image via Endpoints?

Thank you!

Was it helpful?

Solution

The way it finally worked was just open the file with the (open().read()) and save it in the NDB. The response message was a BytesField just sending the string of the open().read(), without any encoding. The console in my browser was not reading the value of the field in the answer, but it works normal in my app.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top