Helper to upload an image to an URL
This new helper, in arkindex_worker.image
will implement the upload of a Pillow Image to an URL.
We need some retry mechanism on the PUT call, similar to _retried_request
. We could generalize that function to support both GET
and PUT
calls, or write a second helper with the same retry mechanism.
b = BytesIO()
pil_image.save(b, format="jpeg")
b.seek(0)
resp = requests.put(url, data=b)
resp.raise_for_status()
return resp