I am sending a gzip file from Postman to a Flask endpoint. I can take that binary file with request.data
and read it, save it, upload it, etc.
My problem is that I can't take its name. How can I do that?
My gzip file is called "test_file.json.gz" and my file is called "test_file.json".
How can I take any of those names?
Edit:
I'm taking the stream data with io.BytesIO(), but this library doesn't contain a name attribute or something, although I can see the file name into the string if I just:
>>>print(request.data)
>>>b'x1fx8bx08x08xcaxb1xd3]x00x03test_file.jsonx00xabxe6RPPxcaNxad4Txb2RP*Kxcc)M5Txe2xaax05x00xc2x8bxb6;x16x00x00x00'
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…