i'm actually trying to do something that i do not know if its ok.
Problem:
I have a web client and a web server, the server (written in python with flask) processes a pdf file in order to get some data, and the client just send the pdf file and waits for the response. The think is that the client can send various pdf files to process and what i want to do is, to send all the pdfs from the client to the server in just one request.
What I have planned to do:
I was thinking on convert the Blob of each pdf in a String and send a POST Request with a JSON body like this:
BODY:
{
"content":[
{"name": "pdf_name_1.pdf", "data": "some blob data converted to string"},
{"name": "pdf_name_2.pdf", "data": "some blob data converted to string"},
{"name": "pdf_name_3.pdf", "data": "some blob data converted to string"},
...
]
}
So then in the server i was thinking to convert again the data into a blob(bytes) in order to write down the pdf a start the processing the data.
My question:
Is there any way to convert the str representation of the pdf to bytes in order to write down in disk the pdf with python?
Thanks a lot, if some one come up with another idea to send bunch of pdfs in only one request let me know please.
pd: I'm using python 3.5 and Flask for the web server.