0

I think that I'm working with a bad API design here, according to the documentation I need to send photo bytes as JPEG in the request, my question is: How to send this bytes in a text/json? below is the documentation to sending photos to this API.

Documentation of sending photos to API

Below is my put request in python:

reply = requests.put(url, data=blob, headers=self.headers)

where blob is the binary of the image.

Bruno Tomé
  • 528
  • 1
  • 6
  • 22

1 Answers1

0

Found the solution, just encode blob to base64 before and then use the json.dumps.

blob = json.dumps(blob.encode("base64"))
reply = requests.put(url, json=blob, headers=self.headers)
Bruno Tomé
  • 528
  • 1
  • 6
  • 22