I am trying transfer a file to Stripe from a firebase database using the stripe.File.create()
method. Here is the code that I am using:
file_url = storage.child("/path/to/file").get_url(token=None)
response = requests.get(file_url, stream=True)
img = Image.open(BytesIO(response.content))
stripe.File.create(
purpose="identity_document",
file=img
)
But when I run this code I get:
Request req_E7fskNVgpHHlRm: Invalid hash
I believe I am getting the correct image from firebase, since I can run the following line and get the image saved to my local drive:
img.save("test.jpg")
But Stripe doest not seem to like the file format that I am giving it. I believe the file has to be supplied in binary mode, so perhaps I simply need to do edit the line img = Image.open(BytesIO(response.content))
to get the file in binary mode.
Any feedback is appreciated.