A customer sends a multipart file to me, I read it with:
blob = request.files['file'].read()
I have a blob file in hand. Now I have to send this file with requests like open('file.png', 'rb'). How can I convert blob to something like rb mode. With open I could not open blob directly.
The below code did not work:
opened_file = open(request.files['file'], 'rb')
And I got the following error:
TypeError: coercing to Unicode: need string or buffer, FileStorage found
Is there a way to do that without saving it on file system? I send my requests to somewhere else:
files = dict({'file': byteArrayFile})
r = requests.post(self.url, files=files, headers=headers)